Permalink
Browse files

Fix external runtime detection under zsh and other shells.

The 'which' builtin command in zsh and tcsh behave differently from
(ba)sh, giving an output of 'xxx not found' if a command can't be
found.

'command -v' is the POSIX-compliant way to find out the full path for
a given command, and should work under all shells.
  • Loading branch information...
Marcus Brito
Marcus Brito committed Jun 21, 2011
1 parent bc2be5a commit da30b02a0b013c51e1eab4488180e8a446b045ee
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/execjs/external_runtime.rb
@@ -123,7 +123,7 @@ def which(command)
result = if ExecJS.windows?
`#{ExecJS.root}/support/which.bat #{name}`
else
- `which #{name} 2>/dev/null`
+ `command -v #{name} 2>/dev/null`
end
if path = result.strip.split("\n").first

0 comments on commit da30b02

Please sign in to comment.