From e6e0f4ecc1db5d2af494ef3ace22fe535590f2a3 Mon Sep 17 00:00:00 2001 From: Greg Skinner Date: Fri, 3 Nov 2023 11:35:08 -0700 Subject: [PATCH] Update clatd In order to capture the exit code from a system() call, right shift $? by eight bits. --- clatd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clatd b/clatd index 22b615d..0cd93ae 100755 --- a/clatd +++ b/clatd @@ -84,7 +84,7 @@ sub err { # # 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 -# any more is the command line arguments. +# any more are the command line arguments. # sub cmd { my $msgsub = shift; @@ -98,7 +98,7 @@ sub cmd { } elsif($? & 127) { &{$msgsub}("cmd(@cmd) died with signal ", ($? & 127)); } else { - &{$msgsub}("cmd(@cmd) returned ", ($? >> 127)); + &{$msgsub}("cmd(@cmd) returned ", ($? >> 8)); } } return $?;