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.
This commit is contained in:
parent
ab80dfc5b7
commit
d58fc0c2e4
@ -65,7 +65,8 @@ module MacOS extend self
|
|||||||
@dev_tools_path ||= if File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make"
|
@dev_tools_path ||= if File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make"
|
||||||
# probably a safe enough assumption (the unix way)
|
# probably a safe enough assumption (the unix way)
|
||||||
Pathname.new "/usr/bin"
|
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.
|
# Wherever "make" is there are the dev tools.
|
||||||
Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname
|
Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname
|
||||||
elsif File.exist? "#{Xcode.prefix}/usr/bin/make"
|
elsif File.exist? "#{Xcode.prefix}/usr/bin/make"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user