lib/bundler.rb in bundler-1.12.0.pre.2 vs lib/bundler.rb in bundler-1.12.0.rc
- old
+ new
@@ -301,15 +301,16 @@
end
def which(executable)
if File.file?(executable) && File.executable?(executable)
executable
- elsif path = ENV["PATH"]
- executable_path = path.split(File::PATH_SEPARATOR).find do |p|
- abs_path = File.join(p, executable)
- File.file?(abs_path) && File.executable?(abs_path)
+ elsif paths = ENV["PATH"]
+ quote = '"'.freeze
+ paths.split(File::PATH_SEPARATOR).find do |path|
+ path = path[1..-2] if path.start_with?(quote) && path.end_with?(quote)
+ executable_path = File.expand_path(executable, path)
+ return executable_path if File.file?(executable_path) && File.executable?(executable_path)
end
- executable_path && File.expand_path(executable, executable_path)
end
end
def sudo(str)
SUDO_MUTEX.synchronize do