uninstall: fix when Cellar doesn't exist

This commit is contained in:
Xu Cheng 2015-10-17 03:57:40 +08:00
parent f81d561b67
commit dee4c76e62

View File

@ -46,10 +46,12 @@ module Homebrew
ensure ensure
# If we delete Cellar/newname, then Cellar/oldname symlink # If we delete Cellar/newname, then Cellar/oldname symlink
# can become broken and we have to remove it. # can become broken and we have to remove it.
if HOMEBREW_CELLAR.directory?
HOMEBREW_CELLAR.children.each do |rack| HOMEBREW_CELLAR.children.each do |rack|
rack.unlink if rack.symlink? && !rack.resolved_path_exists? rack.unlink if rack.symlink? && !rack.resolved_path_exists?
end end
end end
end
def rm_pin(rack) def rm_pin(rack)
Formulary.from_rack(rack).unpin rescue nil Formulary.from_rack(rack).unpin rescue nil