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" ]]
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
odie <<EOS
Your xcode-select path is currently set to '/'.
@ -149,6 +150,10 @@ Otherwise, you should:
EOS
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_STATUS="$?"
@ -159,6 +164,7 @@ You have not agreed to the Xcode license. Please resolve this by running:
sudo xcodebuild -license
EOS
fi
fi
fi
# Many Pathname operations use getwd when they shouldn't, and then throw