Skip to content
Browse files

Merge pull request #60 from eckz/fix-directory-executable

Fixes #59. Avoid find directories as executables.
  • Loading branch information...
2 parents 19c8567 + 57e1043 commit 40206758e7a4fc41090ac82b7e428a6e98880943 @josh josh committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/execjs/external_runtime.rb
View
3 lib/execjs/external_runtime.rb
@@ -130,7 +130,8 @@ def locate_executable(cmd)
cmd
else
path = ENV['PATH'].split(File::PATH_SEPARATOR).find { |p|
- File.executable? File.join(p, cmd)
+ full_path = File.join(p, cmd)
+ File.executable?(full_path) && File.file?(full_path)
}
path && File.expand_path(cmd, path)
end

0 comments on commit 4020675

Please sign in to comment.
Something went wrong with that request. Please try again.