Method: ExecJS::ExternalRuntime#exec_runtime

Defined in:
lib/j1/patches/rubygems/execjs-2.7.0/lib/execjs/external_runtime.rb,
lib/j1/patches/rubygems/execjs-2.7.0/lib/execjs/external_runtime.rb,
lib/j1/patches/rubygems/execjs-2.7.0/lib/execjs/external_runtime.rb

#exec_runtime(filename) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/j1/patches/rubygems/execjs-2.7.0/lib/execjs/external_runtime.rb', line 171

def exec_runtime(filename)
  path = Dir::Tmpname.create(['execjs', 'json']) {}
  begin
    command = binary.split(" ") << filename
    `#{shell_escape(*command)} 2>&1 > #{path}`
    output = File.open(path, 'rb', **@popen_options) { |f| f.read }
  ensure
    File.unlink(path) if path
  end

  if $?.success?
    output
  else
    raise exec_runtime_error(output)
  end
end