Normally, if I want the exit status of a child I just do:
int pid=fork();
switch(pid)
{
case -1:
/*Error treatment*/
exit(1);
case 0:
/*Child part*/
exit(0);
default:
waitpid(pid,&status,0)
WIFEXITED(status);
}
Then I have the exit status on status
.
The problem is that, when the process is on background I obviously don't want to do waitpid()
so I don't know how to store the exit value in status.
Thanks for the help!