Class: Opal::CliRunners::Nashorn

Inherits:
Object
  • Object
show all
Defined in:
opal/lib/opal/cli_runners/nashorn.rb

Defined Under Namespace

Classes: MissingNashorn

Class Method Summary collapse

Class Method Details

.call(data) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'opal/lib/opal/cli_runners/nashorn.rb', line 9

def self.call(data)
  # Allow to change path if using GraalVM, see:
  # https://github.com/graalvm/graaljs/blob/master/docs/user/NashornMigrationGuide.md#launcher-name-js
  exe = ENV['NASHORN_PATH'] || 'jjs'

  SystemRunner.call(data) do |tempfile|
    [exe, tempfile.path, *data[:argv]]
  end
rescue Errno::ENOENT
  raise MissingNashorn, 'Please install JDK or GraalVM to be able to run Opal scripts.'
end