how to set up my background process handler
so I'm writing a shell that can have both foreground and background process. I have a:
signal(SIGCHLD, childHandler);
and thus I have handler:
void childHandler(int signum){
int status开发者_如何学Go, PID;
PID = waitpid(-1, &signum,WNOHANG);
}
this handler captures both foreground and background children that change state. My shell seems to work for foreground processes. However, as soon as I call a background process, things don't work properly anymore... and I think it may be due to this handler.
Can anyone see if something's wrong/missing?
精彩评论