lib/execjs/external_runtime.rb in execjs-0.2.0 vs lib/execjs/external_runtime.rb in execjs-0.2.1

- old
+ new

@@ -110,18 +110,22 @@ end end end def which(command) - Array(command).find do |name| + Array(command).each do |name| name = name.split(/\s+/).first result = if ExecJS.windows? `#{ExecJS.root}/support/which.bat #{name}` else - `which #{name} 2>&1` + `which #{name} 2>/dev/null` end - result.strip.split("\n").first + + if path = result.strip.split("\n").first + return path + end end + nil end if "".respond_to?(:force_encoding) def sh(command) output, options = nil, {}