in reply to (sacked) Re: SIGCHLD and return codes
in thread SIGCHLD and return codes

Looks like that works but how do I return $? from the handler?
  • Comment on Re: (sacked) Re: SIGCHLD and return codes

Replies are listed 'Best First'.
Re: Re: (sacked) Re: SIGCHLD and return codes
by sacked (Hermit) on Nov 17, 2001 at 00:50 UTC
    Use a hash:
    # once again, adapted from perlipc use vars qw( %status ); # our, if you prefer sub REAPER { $waitedpid = wait; # now status is in $? $status{ $waitedpid } = $? >> 8; # loathe sysV: it makes us not only reinstate # the handler, but place it after the wait $SIG{CHLD} = \&REAPER; } $SIG{CHLD} = \&REAPER; while ( my ($k,$v) = each %status ) { print "pid $k\tstatus $v\n" }

    --sacked