formula_installer: skip linking formulae with already installed casks.

If you have the `emacs` or `docker` formulae and casks both
installed the formula will fail to link. Skip trying to link the formula
if the cask is already installed.

Fixes https://github.com/Homebrew/homebrew-core/issues/36310.
This commit is contained in:
Mike McQuaid 2019-01-25 20:10:02 +00:00
parent 2cc50864cc
commit 6f184ea0dd
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -793,6 +793,17 @@ class FormulaInstaller
return
end
cask_installed_with_formula_name = begin
Cask::CaskLoader.load(formula.name).installed?
rescue Cask::CaskUnavailableError
false
end
if cask_installed_with_formula_name
ohai "#{formula.name} cask is installed, skipping link."
return
end
if keg.linked?
opoo "This keg was marked linked already, continuing anyway"
keg.remove_linked_keg_record