Small improvements in the handling of external commands.

This commit is contained in:
Fabian Schlenz 2017-09-25 09:26:58 +02:00
parent 7a1c8e5417
commit 7a83662485

4
dup.rb
View File

@ -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