sstephenson/execjs — Issue #67: Incorrect runtime detection when directory of same name exists
Author: bwbuchanan
Created: 2012-01-21 23:16:15+00:00
State: open

If you have a directory named "nodejs" in your current working directory, then execjs will incorrectly detect it as the nodejs binary, and try to use that as your runtime.

To fix this, ExecJS::ExternalRuntime should check File.file? in addition to File.executable? on the candidate binary.

To reproduce:

1. Have node.js installed with the binary named "node" (not "nodejs")
2. Start with a clean gemset or bundle that includes only execjs
3. At the shell prompt: mkdir nodejs
4. In irb:

```ruby
require 'execjs'
ExecJS.eval('1 + 2')
```

Result:
ExecJS::RuntimeError: sh: nodejs: command not found