in reply to Killing a child process, kills parent process

See subroutines which forks? or try putting $SIG{CHLD} = 'IGNORE'; in your parents.

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: Killing a child process, kills parent process

Replies are listed 'Best First'.
Re^2: Killing a child process, kills parent process
by Marshall (Canon) on Oct 15, 2011 at 11:48 UTC
    Is completely statifactory to reap all children under all *NIX O/S'es.

    $SIG{CHLD} = sub {while (waitpid(-1, WNOHANG) > 0){} };
    This is another way that works on some OS's.

    $SIG{CHLD} = 'IGNORE' # This often works with a few exceptions. # set 'IGNORE' is fastest if it does work. # But there is something to be said for work +ing # all the time, albeit slower (see first sol +ution)
    for those who are interested, the $SIG{CHLD} happens at the sigaction() level. And is faster because no subroutine will be called if the OS supports this option. I am just saying that it is not universally supported.