brew.rb: Don't ask xcrun for output if no CLT is installed (#334)

This avoids `xcrun` popups when installing Homebrew on a non-Xcode
non-CLT machine.
This commit is contained in:
Elliot Saba 2016-06-08 05:53:10 -07:00 committed by Martin Afanasjew
parent 8d64b6a02d
commit 2ca6dbbe9d

View File

@ -137,7 +137,8 @@ export HOMEBREW_USER_AGENT_CURL
if [[ -n "$HOMEBREW_OSX" ]] if [[ -n "$HOMEBREW_OSX" ]]
then then
if [[ "$('/usr/bin/xcode-select' --print-path)" = "/" ]] XCODE_SELECT_PATH=$('/usr/bin/xcode-select' --print-path 2>/dev/null)
if [[ "$XCODE_SELECT_PATH" = "/" ]]
then then
odie <<EOS odie <<EOS
Your xcode-select path is currently set to '/'. Your xcode-select path is currently set to '/'.
@ -149,6 +150,10 @@ Otherwise, you should:
EOS EOS
fi fi
# Don't check xcrun if Xcode and the CLT aren't installed, as that opens
# a popup window asking the user to install the CLT
if [[ -n "$XCODE_SELECT_PATH" ]]
then
XCRUN_OUTPUT="$(/usr/bin/xcrun clang 2>&1)" XCRUN_OUTPUT="$(/usr/bin/xcrun clang 2>&1)"
XCRUN_STATUS="$?" XCRUN_STATUS="$?"
@ -160,6 +165,7 @@ You have not agreed to the Xcode license. Please resolve this by running:
EOS EOS
fi fi
fi fi
fi
# Many Pathname operations use getwd when they shouldn't, and then throw # Many Pathname operations use getwd when they shouldn't, and then throw
# odd exceptions. Reduce our support burden by showing a user-friendly error. # odd exceptions. Reduce our support burden by showing a user-friendly error.