diff options
| author | Misty De Meo | 2012-08-09 16:33:41 -0500 |
|---|---|---|
| committer | Misty De Meo | 2012-08-09 16:33:49 -0500 |
| commit | d58fc0c2e43e5a5f5d60c149cfb44c0fbde96383 (patch) | |
| tree | 03ed90223568a16333d6dbd45e6936cac4712623 /Library/Homebrew | |
| parent | ab80dfc5b784c0da894855016a5140a75e28e696 (diff) | |
| download | brew-d58fc0c2e43e5a5f5d60c149cfb44c0fbde96383.tar.bz2 | |
dev_tools_path: Don't trust exit status of xcrun
A user on IRC was getting strange results from MacOS.dev_tools_path.
It turns out that xcrun's exit status is not always reliable - if
xcrun is a shim and not able to locate the real xcrun, it will exit
0 despite not actually doing what it was asked. Instead check to see
if the stout is empty.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/macos.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 19c33bbc9..62c7e601c 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -65,7 +65,8 @@ module MacOS extend self @dev_tools_path ||= if File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make" # probably a safe enough assumption (the unix way) Pathname.new "/usr/bin" - elsif not Xcode.bad_xcode_select_path? and system "/usr/bin/xcrun -find make 1>/dev/null 2>&1" + # Note that the exit status of system "xcrun foo" isn't always accurate + elsif not Xcode.bad_xcode_select_path? and not `/usr/bin/xcrun -find make 2>/dev/null`.empty? # Wherever "make" is there are the dev tools. Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname elsif File.exist? "#{Xcode.prefix}/usr/bin/make" |
