[pve-devel] [PATCH pve-zsync 09/11] run_cmd: array support

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Sep 28 11:40:10 CEST 2015


---
 pve-zsync | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pve-zsync b/pve-zsync
index c1af115..9fac2fd 100644
--- a/pve-zsync
+++ b/pve-zsync
@@ -10,6 +10,7 @@ use File::Path qw(make_path);
 use Switch;
 use JSON;
 use IO::File;
+use String::ShellQuote 'shell_quote';
 
 my $PROGNAME = "pve-zsync";
 my $CONFIG_PATH = "/var/lib/${PROGNAME}/";
@@ -672,6 +673,9 @@ sub run_cmd {
     my ($cmd) = @_;
     print "Start CMD\n" if $DEBUG;
     print Dumper $cmd if $DEBUG;
+    if (ref($cmd) eq 'ARRAY') {
+	$cmd = join(' ', map { ref($_) ? $$_ : shell_quote($_) } @$cmd);
+    }
     my $output = `$cmd 2>&1`;
 
     die "COMMAND:\n\t$cmd\nGET ERROR:\n\t$output" if 0 != $?;
-- 
2.1.4





More information about the pve-devel mailing list