Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix issue 48 for me #49

Merged
merged 1 commit into from

2 participants

@rubys

Cope with @binary with values such as:
C:\Windows\System32\cscript.exe //E:jscript //Nologo //U

@rubys rubys correctly escape windows reserved shell characters
Cope with @binary with values such as:
  C:\Windows\System32\cscript.exe //E:jscript //Nologo //U
a7cdbfc
@josh

My hero.

@josh josh merged commit 7c903fa into sstephenson:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 20, 2011
  1. @rubys

    correctly escape windows reserved shell characters

    rubys authored
    Cope with @binary with values such as:
      C:\Windows\System32\cscript.exe //E:jscript //Nologo //U
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/execjs/external_runtime.rb
View
5 lib/execjs/external_runtime.rb
@@ -122,7 +122,7 @@ def runner_source
end
def exec_runtime(filename)
- output = sh("#{shell_escape(@binary, filename)} 2>&1")
+ output = sh("#{shell_escape(*(@binary.split(' ') << filename))} 2>&1")
if $?.success?
output
else
@@ -182,7 +182,8 @@ def sh(command)
if ExecJS.windows?
def shell_escape(*args)
- args.map { |arg| arg.inspect }.join(" ")
+ # see http://technet.microsoft.com/en-us/library/cc723564.aspx#XSLTsection123121120120
+ args.map { |arg| arg.gsub(/([&|()<>^ "])/,'^\1') }.join(" ")
end
else
def shell_escape(*args)
Something went wrong with that request. Please try again.