Permalink
Browse files

xcrun: actually try fallbacks

xcrun has a lot of fallbacks if the first case fails but never actually
reaches them on CLT systems since it doesn't check the validity of the
first path before executing it.

(When should it reach these? Mainly for non-Xcode compilers we
support, e.g. apple-gcc42 which can be found by xcrun but which isn't
in /usr/bin)

The xcrun invocation also needed chomping.
  • Loading branch information...
1 parent 2e8e30e commit 032bfcdd8528b68305523c56c38fa98153c3d58c @mistydemeo mistydemeo committed Jan 22, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 Library/ENV/4.3/xcrun
View
@@ -8,14 +8,16 @@ require "#{File.dirname __FILE__}/../libsuperenv"
SUPERBIN = __FILE__.dirname.cleanpath.freeze
exec "/usr/bin/xcrun", *ARGV if ARGV.empty? or ARGV[0][0..0] == '-'
-exec "/usr/bin/#{ARGV.shift}", *ARGV unless ENV['HOMEBREW_SDKROOT'].directory?
+if File.exist?("/usr/bin/#{ARGV.first}")
+ exec "/usr/bin/#{ARGV.shift}", *ARGV unless ENV['HOMEBREW_SDKROOT'].directory?
+end
def try path
exec path, *ARGV if File.executable?(path) and path.cleanpath.dirname != SUPERBIN
end
arg0 = ARGV.shift
-try `/usr/bin/xcrun --find #{arg0}`
+try `/usr/bin/xcrun --find #{arg0}`.chomp
# Nuts, Xcode is not setup properly or something. Try to find the tools anyway!
try "/Applications/Xcode.app/Contents/Developer/usr/bin/#{arg0}"
try "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/#{arg0}"

0 comments on commit 032bfcd

Please sign in to comment.