Skip to content

Instantly share code, notes, and snippets.

@marcolino
Last active December 26, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcolino/7083788 to your computer and use it in GitHub Desktop.
Save marcolino/7083788 to your computer and use it in GitHub Desktop.
check perl system exit code
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