cmd/leaves: handle missing formulae.

We can't get dependencies of unavailable formulae so don't try.

Fixes #3995.
This commit is contained in:
Mike McQuaid 2018-03-29 10:58:01 +01:00
parent 6654ff6e13
commit ce9c8c6808

View File

@ -12,7 +12,13 @@ module Homebrew
installed = Formula.installed.sort
deps_of_installed = installed.flat_map do |f|
f.runtime_dependencies.map(&:to_formula).map(&:full_name)
f.runtime_dependencies.map do |dep|
begin
dep.to_formula.full_name
rescue FormulaUnavailableError
dep.name
end
end
end
leaves = installed.map(&:full_name) - deps_of_installed