Small improvements in the handling of external commands.
This commit is contained in:
parent
7a1c8e5417
commit
7a83662485
4
dup.rb
4
dup.rb
@ -92,7 +92,7 @@ end
|
|||||||
|
|
||||||
def run(cmd, ignore_returnvalue=false)
|
def run(cmd, ignore_returnvalue=false)
|
||||||
puts "+ #{cmd}"
|
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
|
raise "Command returned a non-zero exit value." if returnvalue!=true && !ignore_returnvalue
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ def action_run(container, file)
|
|||||||
if data[yml_name].is_a?(Array)
|
if data[yml_name].is_a?(Array)
|
||||||
data[yml_name].each {|val| cmd << cmd_name << esc(val, options[:escape])}
|
data[yml_name].each {|val| cmd << cmd_name << esc(val, options[:escape])}
|
||||||
elsif data[yml_name].is_a?(Hash)
|
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
|
else
|
||||||
cmd << cmd_name << esc(data[yml_name], options[:escape])
|
cmd << cmd_name << esc(data[yml_name], options[:escape])
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user