Skip to content

Commit

Permalink
[RT#89770] Patch to fix error reporting if command killed by signal
Browse files Browse the repository at this point in the history
Currently if the command is killed by a signal, IPC::Cmd gives an error message containing '%d' and '%s' instead of the information.

% perl -MIPC::Cmd -E '($ok, $err) = IPC::Cmd::run(command => [ qw(perl -E dump) ]); say $err'
'perl -E dump' died with signal %d, %s coredump

This is because the error string contains printf() style placeholders, which are not understood by loc(), the function used to generate localized error messages.  Fix it like this:

With this fix, the correct error is given:

% perl -MIPC::Cmd -E '($ok, $err) = IPC::Cmd::run(command => [ qw(perl -E dump) ]); say $err'
'perl -E dump' died with signal 6, with coredump

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
  • Loading branch information
Ed Avis authored and bingos committed Oct 25, 2013
1 parent be71b20 commit 9f1ce33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/IPC/Cmd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ sub _pp_child_error {

} elsif ( $ce & 127 ) {
### some signal
$str = loc( "'%1' died with signal %d, %s coredump\n",
$str = loc( "'%1' died with signal %2, %3 coredump",
$pp_cmd, ($ce & 127), ($ce & 128) ? 'with' : 'without');

} else {
Expand Down

0 comments on commit 9f1ce33

Please sign in to comment.