]> git.proxmox.com Git - pve-zsync.git/commitdiff
run_cmd: array support
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 28 Sep 2015 09:40:10 +0000 (11:40 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 16 Oct 2015 09:00:15 +0000 (11:00 +0200)
pve-zsync

index c1af115860486b45f04ae3bc49b0dddf47b23ca6..9fac2fdd0c748288834e6e89cf63f7d6c670a072 100644 (file)
--- 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 != $?;