diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index d86bc8298c..2fba870a71 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -35,13 +35,6 @@ rescue MissingEnvironmentVariables => e exec ENV["HOMEBREW_BREW_FILE"], *ARGV end -def output_unsupported_error - $stderr.puts <<~EOS - Please create pull requests instead of asking for help on Homebrew's GitHub, - Discourse, Twitter or IRC. - EOS -end - begin trap("INT", std_trap) # restore default CTRL-C handler @@ -150,7 +143,12 @@ rescue BuildError => e Utils::Analytics.report_build_error(e) e.dump - output_unsupported_error if e.formula.head? || e.formula.deprecated? || e.formula.disabled? + if e.formula.head? || e.formula.deprecated? || e.formula.disabled? + $stderr.puts <<~EOS + Please create pull requests instead of asking for help on Homebrew's GitHub, + Discourse, Twitter or IRC. + EOS + end exit 1 rescue RuntimeError, SystemCallError => e @@ -159,8 +157,6 @@ rescue RuntimeError, SystemCallError => e onoe e $stderr.puts e.backtrace if Homebrew.args.debug? - output_unsupported_error if Homebrew.args.HEAD? - exit 1 rescue MethodDeprecatedError => e onoe e diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb index 03aea114e4..64ca28f97f 100644 --- a/Library/Homebrew/patch.rb +++ b/Library/Homebrew/patch.rb @@ -159,6 +159,11 @@ class ExternalPatch end end end + rescue ErrorDuringExecution => e + raise unless (f = resource.owner&.owner) + + cmd, *args = e.cmd + raise BuildError.new(f, cmd, args, ENV.to_hash) end def inspect diff --git a/Library/Homebrew/test/patching_spec.rb b/Library/Homebrew/test/patching_spec.rb index ffdf1027dc..737e140676 100644 --- a/Library/Homebrew/test/patching_spec.rb +++ b/Library/Homebrew/test/patching_spec.rb @@ -149,7 +149,7 @@ describe "patching" do end f.brew { |formula, _staging| formula.patch } - }.to raise_error(ErrorDuringExecution) + }.to raise_error(BuildError) end specify "single_patch_dsl_with_incorrect_strip_with_apply" do @@ -163,7 +163,7 @@ describe "patching" do end f.brew { |formula, _staging| formula.patch } - }.to raise_error(ErrorDuringExecution) + }.to raise_error(BuildError) end specify "patch_p0_dsl" do @@ -219,7 +219,7 @@ describe "patching" do end f.brew { |formula, _staging| formula.patch } - }.to raise_error(ErrorDuringExecution) + }.to raise_error(BuildError) end end