Fix argument split for conmux so that we support ' " and spaces for arguments
Signed-off-by: Scott Zawalski <scottz@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3136 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/conmux/conmux b/conmux/conmux
index 4c45f60..12bc871 100755
--- a/conmux/conmux
+++ b/conmux/conmux
@@ -654,8 +654,13 @@
}
local(*IN, *OUT, *ERR);
- my ($cmd, @args) = split(' ', $run . " $a");
- my $pid = IPC::Open3::open3(*IN, *OUT, *ERR, $cmd, @args);
+ my ($cmd, @args) = split(m/'(.*?)'|"(.*?)"|\s(.*?)\s/g, $run . " $a");
+ my @opts;
+ for (my $i=0; $i < @args; $i++) {
+ next if not $args[$i];
+ push(@opts, $args[$i]);
+ }
+ my $pid = IPC::Open3::open3(*IN, *OUT, *ERR, $cmd, @opts);
close(*IN{IO});
# XXX: this should not be happening here.