in reply to Finding if a child process has terminated

Use kill 0 => $childpid to check; if that returns false and $! == ERSCH then it's not running.

Replies are listed 'Best First'.
Re^2: Finding if a child process has terminated
by RazorbladeBidet (Friar) on Mar 28, 2005 at 15:42 UTC
    Note that I have to add a
    $SIG{CHLD}='IGNORE';
    for this to work (with no other previous $SIG{CHLD})

    Running AIX 5.2 Perl 5.8.0
    --------------
    "But what of all those sweet words you spoke in private?"
    "Oh that's just what we call pillow talk, baby, that's all."

      Ah, you're correct. Until something waits on the process it'll still have an entry in the process table and hence be "alive" as far as sending signal 0 goes. Sending signal 0 is probably of more use in checking if an unrelated process (or at least non-descendent process) is alive.

      Update: And you can see this behavior with the code below.