Print quotes around executed arguments with spaces
Eg: ['foo', 'bar la'] -> "foo 'bar la'"
This commit is contained in:
parent
2037b2373a
commit
0a27f041d0
@ -61,11 +61,23 @@ HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY
|
|||||||
|
|
||||||
|
|
||||||
class ExecutionError <RuntimeError
|
class ExecutionError <RuntimeError
|
||||||
attr :status
|
attr :exit_status
|
||||||
|
|
||||||
def initialize cmd, args=[], status=nil
|
def initialize cmd, args = [], es = nil
|
||||||
super "Failure while executing: #{cmd} #{args*' '}"
|
super "Failure while executing: #{cmd} #{pretty(args)*' '}"
|
||||||
@status = status
|
@exit_status = es.exitstatus rescue 1
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def pretty args
|
||||||
|
args.collect do |arg|
|
||||||
|
if arg.include? ' '
|
||||||
|
"'#{ arg.gsub "'", "\\'" }'"
|
||||||
|
else
|
||||||
|
arg
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
2
bin/brew
2
bin/brew
@ -331,7 +331,7 @@ rescue BuildError => e
|
|||||||
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{$2}"
|
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{$2}"
|
||||||
ohai "Environment"
|
ohai "Environment"
|
||||||
dump_config
|
dump_config
|
||||||
puts "Exit status: #{e.status.exitstatus}"
|
puts "Exit status: #{e.exit_status}"
|
||||||
onoe e
|
onoe e
|
||||||
puts PLEASE_REPORT_BUG
|
puts PLEASE_REPORT_BUG
|
||||||
# this feature can be slow (depends on network conditions and if github is up)
|
# this feature can be slow (depends on network conditions and if github is up)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user