~mdw
/
with-authinfo-kludge
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
with-authinfo-kludge: Use `native' exit status and related interfaces.
[with-authinfo-kludge]
/
with-authinfo-kludge
diff --git
a/with-authinfo-kludge
b/with-authinfo-kludge
index
4317d8d
..
d2d62fe
100755
(executable)
--- a/
with-authinfo-kludge
+++ b/
with-authinfo-kludge
@@
-762,17
+762,18
@@
set_sighandler "CHLD", sub {
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};
my ($how, $rc);
my ($how, $rc);
- if (
$?
== 0) {
+ 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 =
$? >> 8
;
+ $rc =
WEXITSTATUS($st)
;
$how = "exited with status $rc";
}
if ($kid == $CLIENTKID) {
$how = "exited with status $rc";
}
if ($kid == $CLIENTKID) {