execjs 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ require "shellwords"
1
2
  require "tempfile"
2
3
 
3
4
  module ExecJS
@@ -120,7 +121,7 @@ module ExecJS
120
121
  end
121
122
 
122
123
  def exec_runtime(filename)
123
- output = sh("#{@binary} #{filename} 2>&1")
124
+ output = sh("#{Shellwords.join([@binary, filename])} 2>&1")
124
125
  if $?.success?
125
126
  output
126
127
  else
@@ -131,7 +132,7 @@ module ExecJS
131
132
  def locate_binary
132
133
  if binary = which(@command)
133
134
  if @test_args
134
- output = `#{binary} #{@test_args} 2>&1`
135
+ output = `#{Shellwords.join([binary, @test_args])} 2>&1`
135
136
  binary if output.match(@test_match)
136
137
  else
137
138
  binary
@@ -143,9 +144,9 @@ module ExecJS
143
144
  Array(command).each do |name|
144
145
  name, args = name.split(/\s+/, 2)
145
146
  result = if ExecJS.windows?
146
- `"#{ExecJS.root}/support/which.bat" #{name}`
147
+ `#{Shellwords.join(["#{ExecJS.root}/support/which.bat", name])}`
147
148
  else
148
- `command -v #{name} 2>/dev/null`
149
+ `#{Shellwords.join(['command', '-v', name])} 2>/dev/null`
149
150
  end
150
151
 
151
152
  if path = result.strip.split("\n").first
@@ -18,7 +18,8 @@ module ExecJS
18
18
  Node = ExternalRuntime.new(
19
19
  :name => "Node.js (V8)",
20
20
  :command => ["nodejs", "node"],
21
- :runner_path => ExecJS.root + "/support/node_runner.js"
21
+ :runner_path => ExecJS.root + "/support/node_runner.js",
22
+ :encoding => 'UTF-8'
22
23
  )
23
24
 
24
25
  JavaScriptCore = ExternalRuntime.new(
@@ -1,3 +1,3 @@
1
1
  module ExecJS
2
- VERSION = "1.2.6"
2
+ VERSION = "1.2.7"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execjs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 6
10
- version: 1.2.6
9
+ - 7
10
+ version: 1.2.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sam Stephenson
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-09-13 00:00:00 -05:00
19
+ date: 2011-09-19 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  requirements: []
163
163
 
164
164
  rubyforge_project:
165
- rubygems_version: 1.5.2
165
+ rubygems_version: 1.6.2
166
166
  signing_key:
167
167
  specification_version: 3
168
168
  summary: Run JavaScript code from Ruby