From 7a836624850c4dfcdce9259df3c1a893709e516e Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Mon, 25 Sep 2017 09:26:58 +0200 Subject: [PATCH] Small improvements in the handling of external commands. --- dup.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dup.rb b/dup.rb index ea4c548..70146b0 100755 --- a/dup.rb +++ b/dup.rb @@ -92,7 +92,7 @@ end def run(cmd, ignore_returnvalue=false) puts "+ #{cmd}" - returnvalue = $dry_run ? true : system(cmd) + returnvalue = $dry_run ? true : system("bash -c #{cmd.shellescape}") raise "Command returned a non-zero exit value." if returnvalue!=true && !ignore_returnvalue end @@ -147,7 +147,7 @@ def action_run(container, file) if data[yml_name].is_a?(Array) data[yml_name].each {|val| cmd << cmd_name << esc(val, options[:escape])} elsif data[yml_name].is_a?(Hash) - data[yml_name].each {|key, val| cmd << cmd_name << "#{esc(key, options[:escape])}=#{esc(val, options[:escape])}"} + data[yml_name].each {|key, val| cmd << cmd_name << "#{esc(key, options[:escape])}=\"#{esc(val, options[:escape])}\""} else cmd << cmd_name << esc(data[yml_name], options[:escape]) end