aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2012-02-20 18:24:36 +0000
committerMax Howell2012-02-20 18:24:36 +0000
commit2759dcf06b0f646ff46f7f8057abfde3f7a9bc65 (patch)
tree3ee15690ac27939ddeed92b023a7d408bcef2281
parent6af4cc9f27c4b4cb024acfe895c3ebfcac46d993 (diff)
downloadbrew-2759dcf06b0f646ff46f7f8057abfde3f7a9bc65.tar.bz2
Don't hang if xcode-select is set to "/"
-rw-r--r--Library/Homebrew/utils.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index a0491a255..2854c82b1 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -317,7 +317,7 @@ module MacOS extend self
@xcode_prefix ||= begin
path = `/usr/bin/xcode-select -print-path 2>/dev/null`.chomp
path = Pathname.new path
- if path.directory? and path.absolute?
+ if $?.success? and path.directory? and path.absolute?
path
elsif File.directory? '/Developer'
# we do this to support cowboys who insist on installing
@@ -343,9 +343,12 @@ module MacOS extend self
def xcode_version
@xcode_version ||= begin
+ # Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus
+ raise if `xcode-select -print-path 2>/dev/null`.chomp == "/"
+
raise unless system "/usr/bin/which -s xcodebuild"
- `xcodebuild -version 2>&1` =~ /Xcode (\d(\.\d)*)/
- raise if $1.nil?
+ `xcodebuild -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
+ raise if $1.nil? or not $?.success?
$1
rescue
# for people who don't have xcodebuild installed due to using