Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #58 from luislavena/remove-subshells-windows

Remove subshells windows
  • Loading branch information...
commit 0c168fc627226862960d628f2d405fbc056894f0 2 parents c1f0953 + 9df348e
@sstephenson authored
Showing with 5 additions and 8 deletions.
  1. +5 −6 lib/execjs/external_runtime.rb
  2. +0 −2  lib/execjs/support/which.bat
View
11 lib/execjs/external_runtime.rb
@@ -121,12 +121,11 @@ def binary
@binary ||= locate_binary
end
- def which_windows(name)
- result = `#{shell_escape("#{ExecJS.root}/support/which.bat", name)}`
- result.strip.split("\n").first
- end
+ def locate_executable(cmd)
+ if ExecJS.windows? && File.extname(cmd) == ""
+ cmd << ".exe"
+ end
- def which_unix(cmd)
if File.executable? cmd
cmd
else
@@ -165,7 +164,7 @@ def locate_binary
def which(command)
Array(command).find do |name|
name, args = name.split(/\s+/, 2)
- path = ExecJS.windows? ? which_windows(name) : which_unix(name)
+ path = locate_executable(name)
next unless path
View
2  lib/execjs/support/which.bat
@@ -1,2 +0,0 @@
-@rem Taken from http://blogs.msdn.com/b/oldnewthing/archive/2005/01/20/357225.aspx
-@for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" @echo %%~$PATH:i
Please sign in to comment.
Something went wrong with that request. Please try again.