Browse files

Fix external runtime which to return the expanded path

  • Loading branch information...
1 parent 8701188 commit 612c95e077166919d8e93e987f516bff5e20871d @josh josh committed Apr 22, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/execjs/external_runtime.rb
View
8 lib/execjs/external_runtime.rb
@@ -112,15 +112,19 @@ def locate_binary
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`
end
- result.strip.split("\n").first
+
+ if path = result.strip.split("\n").first
+ return path
+ end
end
+ nil
end
if "".respond_to?(:force_encoding)

0 comments on commit 612c95e

Please sign in to comment.