I've got this function which is supposed to return to the calling main if amp is 1 without waiting for the child to finish. When it returns, it's supposed to show a prompt but it doesn't show anything?
int my_system(char** argv,int amp)
{
int pid=0;
int status;
if(amp)
{
signal(SIGCHLD, SIG_IGN);
}
pid = fork();
if(pid==0)
execvp(argv[0], argv);
else if(pid>0)
{
if(amp==0)
{
wait(&status);
if(status>=0)
return 0;
else
exit(EXIT_FAILURE);
}
else
{
return 0;
}
}
}
Aucun commentaire:
Enregistrer un commentaire