but when i use fork, it still wait the status of the program.I gather that your parent is hanging someplace where you don't want it to hang. Are you calling wait or waitpid in the parent?
If you don't need the exit status of a child process, you never need to call wait or waitpid or handle SIGCHLD. A 'zombie' process will be created when the child exits, but this is simply the child's entry in the system's process table and doesn't consume any appreciable memory. Zombie entries will be released when the parent exits.
If you want to check if a child has exited without hanging, then call waitpid with the WNOHANG parameter - see perldoc -f waitpid for an example.
In reply to Re: Fork and exec
by pc88mxer
in thread Fork and exec
by perlmonkdr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |