diff options
| author | Max Howell | 2012-02-20 18:24:36 +0000 |
|---|---|---|
| committer | Max Howell | 2012-02-20 18:24:36 +0000 |
| commit | 45552fcf4c78a2530024692a22e56bd568b1c5db (patch) | |
| tree | 5d4888fbb4972b96d18aea8c960e2c3cd4132f42 /Library | |
| parent | 49b4c4fbeff3fbb21fbb43c30a433e68b9f8b12b (diff) | |
| download | homebrew-45552fcf4c78a2530024692a22e56bd568b1c5db.tar.bz2 | |
Don't hang if xcode-select is set to "/"
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/utils.rb | 9 |
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 |
