Merge pull request #7198 from scpeters/formula_installer_rescue_already_attempted_link

FormulaInstaller: link tmp kegs during rescue
This commit is contained in:
Mike McQuaid 2020-03-22 09:14:35 +00:00 committed by GitHub
commit 12d3a2a2d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -598,16 +598,16 @@ class FormulaInstaller
oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}"
fi.install
fi.finish
rescue FormulaInstallationAlreadyAttemptedError
# We already attempted to install f as part of the dependency tree of
# another formula. In that case, don't generate an error, just move on.
nil
rescue Exception # rubocop:disable Lint/RescueException
rescue Exception => e # rubocop:disable Lint/RescueException
ignore_interrupts do
tmp_keg.rename(installed_keg) if tmp_keg && !installed_keg.directory?
linked_keg.link if keg_was_linked
end
raise
raise unless e.is_a? FormulaInstallationAlreadyAttemptedError
# We already attempted to install f as part of another formula's
# dependency tree. In that case, don't generate an error, just move on.
nil
else
ignore_interrupts { tmp_keg.rmtree if tmp_keg&.directory? }
end