install: unlink old kegs
If a formula makes it all the way to the actual install step, it is safe to unlink the keg before linking; this will prune dead symlinks in the case where a keg was removed with `rm -rf <keg>` but not unlinked with `brew unlink`. Fixes Homebrew/homebrew#10077. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
6cfe4b3208
commit
511598fa37
@ -103,6 +103,10 @@ module Homebrew extend self
|
|||||||
begin
|
begin
|
||||||
fi = FormulaInstaller.new(f)
|
fi = FormulaInstaller.new(f)
|
||||||
fi.install
|
fi.install
|
||||||
|
# Due to the nature of Keg#unlink, this will remove symlinks from an
|
||||||
|
# older keg, which may still be present if an uninstallation was done
|
||||||
|
# via `rm -rf <keg>`; this is desired.
|
||||||
|
Keg.new("#{f.rack}/#{f.version}").unlink
|
||||||
fi.caveats
|
fi.caveats
|
||||||
fi.finish
|
fi.finish
|
||||||
rescue FormulaAlreadyInstalledError => e
|
rescue FormulaAlreadyInstalledError => e
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user