in reply to $? outside SIGCHLD handler
ug, use IO::Select. It's a thin wrapper over select that's *much* easier to use than the underlying function.
You didn't show your signal handler. If it calls wait or waitpid, don't call wait or waitpid outside of the handler. Save the result from the handler, if you need to.
my %reaped; $SIG{CHLD} = sub { my $pid = wait(); $reaped{$pid} = $?; }; # When reading from read ready handle returns eof, my $exit_code = delete $reaped{$pid_associated_with_handle};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: $? outside SIGCHLD handler
by Anonymous Monk on Sep 08, 2009 at 18:24 UTC | |
by kenshin (Initiate) on Sep 08, 2009 at 18:26 UTC |