Reorganize conditional to avoid shelling out if possible

This commit is contained in:
Jack Nagel 2014-04-01 18:40:20 -05:00
parent 2932bc5347
commit 66c8f2707c

View File

@ -34,8 +34,8 @@ end
# Check for bad xcode-select before anything else, because `doctor` and # Check for bad xcode-select before anything else, because `doctor` and
# many other things will hang # many other things will hang
# Note that this bug was fixed in 10.9 # Note that this bug was fixed in 10.9
if OS.mac? && `xcode-select -print-path 2>/dev/null`.chomp == '/' && MacOS.version < :mavericks if OS.mac? && MacOS.version < :mavericks && MacOS::Xcode.bad_xcode_select_path?
ofail <<-EOS.undent odie <<-EOS.undent
Your xcode-select path is currently set to '/'. Your xcode-select path is currently set to '/'.
This causes the `xcrun` tool to hang, and can render Homebrew unusable. This causes the `xcrun` tool to hang, and can render Homebrew unusable.
If you are using Xcode, you should: If you are using Xcode, you should:
@ -43,8 +43,6 @@ if OS.mac? && `xcode-select -print-path 2>/dev/null`.chomp == '/' && MacOS.versi
Otherwise, you should: Otherwise, you should:
sudo rm -rf /usr/share/xcode-select sudo rm -rf /usr/share/xcode-select
EOS EOS
exit 1
end end
case HOMEBREW_PREFIX.to_s when '/', '/usr' case HOMEBREW_PREFIX.to_s when '/', '/usr'