Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Remove subshells windows #58

Merged
merged 2 commits into from Dec 6, 2011
Jump to file or symbol
Failed to load files and symbols.
+5 −8
Split
@@ -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
@@ -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