Update clatd
In order to capture the exit code from a system() call, right shift $? by eight bits.
This commit is contained in:
committed by
Tore Anderson
parent
a93f5ff491
commit
e6e0f4ecc1
4
clatd
4
clatd
@@ -84,7 +84,7 @@ sub err {
|
|||||||
#
|
#
|
||||||
# Runs a command. First argument is what subroutine to call to a message if
|
# Runs a command. First argument is what subroutine to call to a message if
|
||||||
# the command doesn't exit successfully, second is the command itself, and
|
# the command doesn't exit successfully, second is the command itself, and
|
||||||
# any more is the command line arguments.
|
# any more are the command line arguments.
|
||||||
#
|
#
|
||||||
sub cmd {
|
sub cmd {
|
||||||
my $msgsub = shift;
|
my $msgsub = shift;
|
||||||
@@ -98,7 +98,7 @@ sub cmd {
|
|||||||
} elsif($? & 127) {
|
} elsif($? & 127) {
|
||||||
&{$msgsub}("cmd(@cmd) died with signal ", ($? & 127));
|
&{$msgsub}("cmd(@cmd) died with signal ", ($? & 127));
|
||||||
} else {
|
} else {
|
||||||
&{$msgsub}("cmd(@cmd) returned ", ($? >> 127));
|
&{$msgsub}("cmd(@cmd) returned ", ($? >> 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $?;
|
return $?;
|
||||||
|
|||||||
Reference in New Issue
Block a user