4 use Getopt
::Long qw
/:config no_ignore_case permute/;
7 $0 = "reportcmdstatus";
12 'c|clone!' => \
$clone_status,
13 'help|?' => sub{ pod2usage
(-exitval
=>0, -verbose
=>99); },
14 '<>' => sub{ unshift @ARGV, @_; die '!FINISH'; },
15 ) or pod2usage
(-exitval
=>2, -verbose
=>99);
18 $status = ${^CHILD_ERROR_NATIVE
};
20 if(WIFSIGNALED
($status))
22 printf STDERR
"command terminated by signal %d.\n", WTERMSIG
($status);
23 $mystatus = 128 + WTERMSIG
($status);
27 printf STDERR
"command exited with status %d.\n", WEXITSTATUS
($status);
28 $mystatus = WEXITSTATUS
($status);
31 exit $mystatus if $clone_status;
41 reportcmdstatus - Textually show how the given command finished (exit status/signal)
45 reportcmdstatus [-c] [--] <COMMAND> [<ARGS>]
53 Take COMMAND's status and itself exits with it.