diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 0a5526a5f4..9dbb894498 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -479,7 +479,7 @@ class BuildError < RuntimeError @cmd = cmd @args = args @env = env - pretty_args = Array(args).map { |arg| arg.to_s.gsub " ", "\\ " }.join(" ") + pretty_args = Array(args).map { |arg| arg.to_s.gsub(/[\\ ]/, "\\\\\\0") }.join(" ") super "Failed executing: #{cmd} #{pretty_args}".strip end