From 0c974d622d62e3f0a886076686035cb9d0afa61b Mon Sep 17 00:00:00 2001 From: Tristan Hanson Date: Fri, 2 Oct 2015 10:39:41 -0500 Subject: [PATCH] Stripping leading/trailing whitespace from paths on windows when locating runtime binaries --- lib/execjs/external_runtime.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/execjs/external_runtime.rb b/lib/execjs/external_runtime.rb index 2133ce3..e18ff07 100644 --- a/lib/execjs/external_runtime.rb +++ b/lib/execjs/external_runtime.rb @@ -124,7 +124,7 @@ def locate_executable(command) commands = Array(command) if ExecJS.windows? && File.extname(command) == "" ENV['PATHEXT'].split(File::PATH_SEPARATOR).each { |p| - commands << (command + p) + commands << (command + p.strip) } end @@ -133,7 +133,7 @@ def locate_executable(command) cmd else path = ENV['PATH'].split(File::PATH_SEPARATOR).find { |p| - full_path = File.join(p, cmd) + full_path = File.join(p.strip, cmd) File.executable?(full_path) && File.file?(full_path) } path && File.expand_path(cmd, path)