Merge pull request #8592 from reitermarkus/desc-cache-ignore-exceptions

Ignore `FormulaUnreadableError` in `Formula.each`.
This commit is contained in:
Markus Reiter 2020-09-03 20:21:02 +02:00 committed by GitHub
commit 2dbaaf35aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -1460,16 +1460,14 @@ class Formula
# @private
def self.each
files.each do |file|
yield begin
Formulary.factory(file)
rescue FormulaUnavailableError => e
yield Formulary.factory(file)
rescue FormulaUnavailableError, FormulaUnreadableError => e
# Don't let one broken formula break commands. But do complain.
onoe "Failed to import: #{file}"
puts e
$stderr.puts e
next
end
end
end
# Clear cache of .racks
def self.clear_racks_cache

View File

@ -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