We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`int pid = fork(); if(pid==-1){return -1;} if(pid==0) { //if(dup2(fileno(fopen(output_path,"w")),STDOUT_FILENO)==-1) //test1 if(dup2(open(output_path,O_RDWR|O_CREAT|O_TRUNC),STDOUT_FILENO)==-1) //test2 { return -1; } execve(path,argv,NULL); } else { int exitcode; int p = waitpid(pid,&exitcode,0); if(p==-1){return -1;}
if(!WIFEXITED(exitcode)) //pid didn't end correctly { return -1; } else { return WEXITSTATUS(exitcode); }
}` avec la ligne test1, ca passe, avec test2, l'on obtient le message d'erreur suivant :
Running suite(s): Shell 75%: Checks: 4, Failures: 1, Errors: 0 shell_test.c:85:F:Core:test_redirect:0: Assertion 'fd >= 0' failed test_redirect s’est terminé après le message suivant : Exécution de "echo 'Hello World' > file_a"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
`int pid = fork(); if(pid==-1){return -1;}
if(pid==0)
{
//if(dup2(fileno(fopen(output_path,"w")),STDOUT_FILENO)==-1) //test1
if(dup2(open(output_path,O_RDWR|O_CREAT|O_TRUNC),STDOUT_FILENO)==-1) //test2
{
return -1;
}
execve(path,argv,NULL);
}
else
{
int exitcode;
int p = waitpid(pid,&exitcode,0);
if(p==-1){return -1;}
}`
avec la ligne test1, ca passe, avec test2, l'on obtient le message d'erreur suivant :
The text was updated successfully, but these errors were encountered: