Last active
December 26, 2015 03:09
-
-
Save marcolino/7083788 to your computer and use it in GitHub Desktop.
check perl system exit code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system(...); | |
if ($? == -1) { | |
print "failed to execute: $!\n"; | |
} | |
elsif ($? & 127) { | |
printf "child died with signal %d, %s coredump\n", | |
($? & 127), ($? & 128) ? 'with' : 'without'; | |
} | |
else { | |
printf "child exited with value %d\n", $? >> 8; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment