From d58fc0c2e43e5a5f5d60c149cfb44c0fbde96383 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Thu, 9 Aug 2012 16:33:41 -0500 Subject: [PATCH] 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. --- Library/Homebrew/macos.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 19c33bbc9d..62c7e601cc 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"