doctor: skip Cellar checks if Cellar doesn't exist

Attempting to call certain methods on the Cellar before it exists,
such as realpath, would cause brew doctor to throw unnecessary "file
does not exist" errors. This was fixed once before, but new tests
have been added since without the appropriate checks.
cf. 0d28bc78d71590c8e8a5961d8d10e3d7d9b8822d

Fixes Homebrew/homebrew#5188 (again).
This commit is contained in:
Misty De Meo 2012-04-08 15:28:16 -05:00
parent 25a148d6a1
commit c9fd1b9bf0

View File

@ -515,7 +515,8 @@ def check_for_iconv
end
def check_for_config_scripts
real_cellar = HOMEBREW_CELLAR.exist? && HOMEBREW_CELLAR.realpath
return unless HOMEBREW_CELLAR.exist?
real_cellar = HOMEBREW_CELLAR.realpath
config_scripts = []
@ -835,6 +836,7 @@ def check_for_outdated_homebrew
end
def check_for_unlinked_but_not_keg_only
return unless HOMEBREW_CELLAR.exist?
unlinked = HOMEBREW_CELLAR.children.reject do |rack|
if not rack.directory?
true