We're going to need to do things with process exit statuses that Perl
doesn't expose through its cooked exit status.
defined (my $kid = waitpid -1, WNOHANG)
or sysfail "failed to reap child: $!";
last KID if $kid <= 0;
defined (my $kid = waitpid -1, WNOHANG)
or sysfail "failed to reap child: $!";
last KID if $kid <= 0;
+ my $st = ${^CHILD_ERROR_NATIVE};
+ if (WIFEXITED($st) && WEXITSTATUS($st) == 0) {
$how = "exited successfully";
$rc = 0;
$how = "exited successfully";
$rc = 0;
- } elsif ($? & 0xff) {
- my $sig = $? & 0x7f;
+ } elsif (WIFSIGNALED($st)) {
+ my $sig = WTERMSIG($st);
$how = "killed by signal $sig";
$how .= " (core dumped)" if $? & 0x80;
$rc = $sig | 0x80;
} else {
$how = "killed by signal $sig";
$how .= " (core dumped)" if $? & 0x80;
$rc = $sig | 0x80;
} else {
+ $rc = WEXITSTATUS($st);
$how = "exited with status $rc";
}
if ($kid == $CLIENTKID) {
$how = "exited with status $rc";
}
if ($kid == $CLIENTKID) {