From 8fb769e60c1ec4aa04582f640e426fd9a4d09c66 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 3 Sep 2020 19:34:25 +0200 Subject: [PATCH] Ignore `FormulaUnreadableError` in `Formula.each`. --- Library/Homebrew/formula.rb | 14 ++++++-------- Library/Homebrew/formulary.rb | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index fb764285c9..f2a03f1980 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1460,14 +1460,12 @@ class Formula # @private def self.each files.each do |file| - yield begin - Formulary.factory(file) - rescue FormulaUnavailableError => e - # Don't let one broken formula break commands. But do complain. - onoe "Failed to import: #{file}" - puts e - next - end + yield Formulary.factory(file) + rescue FormulaUnavailableError, FormulaUnreadableError => e + # Don't let one broken formula break commands. But do complain. + onoe "Failed to import: #{file}" + $stderr.puts e + next end end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 844000d618..8b10df0220 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -42,7 +42,7 @@ module Formulary # access them from within the formula's class scope. mod.const_set(:BUILD_FLAGS, flags) mod.module_eval(contents, path) - rescue NameError, ArgumentError, ScriptError => e + rescue NameError, ArgumentError, ScriptError, MethodDeprecatedError => e $stderr.puts e.backtrace if Homebrew::EnvConfig.developer? raise FormulaUnreadableError.new(name, e) end