Subject: | Empty string cannot be passed to command |
For example, here is a command that accepts an option 'A' receiving empty string:
$ command --A "" arg1 arg2
And we try to run this command via IPC::Cmd:
IPC::Cmd::run( command => ["command", "--A", "", "arg1", "arg2"]);
Then, the following command-line are generated
because IPC::Cmd strips any empty elements.
$ command --A arg1 arg2
Subject: | Cmd.pm.patch |
--- Cmd.pm.orig 2012-01-28 18:06:59.000000000 +0900
+++ Cmd.pm 2012-01-28 18:07:12.000000000 +0900
@@ -1072,7 +1072,7 @@
$cmd = _quote_args_vms( $cmd ) if IS_VMS;
### strip any empty elements from $cmd if present
- $cmd = [ grep { defined && length } @$cmd ] if ref $cmd;
+ $cmd = [ grep { defined } @$cmd ] if ref $cmd;
my $pp_cmd = (ref $cmd ? "@$cmd" : $cmd);
print loc("Running [%1]...\n", $pp_cmd ) if $verbose;