Skip Menu |

This queue is for tickets about the IPC-Cmd CPAN distribution.

Report information
The Basics
Id: 89770
Status: patched
Priority: 0/
Queue: IPC-Cmd

People
Owner: Nobody in particular
Requestors: EDAVIS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Patch to fix error reporting if command killed by signal
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: diff -ru IPC-Cmd-0.85_02/lib/IPC/Cmd.pm IPC-Cmd-0.85_02-new/lib/IPC/Cmd.pm --- IPC-Cmd-0.85_02/lib/IPC/Cmd.pm 2013-10-10 14:04:59.000000000 +0100 +++ IPC-Cmd-0.85_02-new/lib/IPC/Cmd.pm 2013-10-25 10:57:41.264283664 +0100 @@ -1849,7 +1849,7 @@ } 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 { 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
Many thanks, I have applied this in the IPC-Cmd source code repository. https://github.com/jib/ipc-cmd/commit/9f1ce337b3ae71a63382ff66098a9e17a75b3545