Permalink
Browse files

Preserve command flags passed to which

  • Loading branch information...
1 parent 5831cff commit 88fa6b7e065cf91210840e9e3ca7ddfda74248c4 @swaits swaits committed with josh May 5, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/execjs/external_runtime.rb
@@ -113,15 +113,15 @@ def locate_binary
def which(command)
Array(command).each do |name|
- name = name.split(/\s+/).first
+ name, args = name.split(/\s+/, 2)
result = if ExecJS.windows?
`#{ExecJS.root}/support/which.bat #{name}`
else
`which #{name} 2>/dev/null`
end
if path = result.strip.split("\n").first
- return path
+ return args ? "#{path} #{args}" : path
end
end
nil

0 comments on commit 88fa6b7

Please sign in to comment.