Class: Opal::CliRunners::Quickjs

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

Overview

QuickJS is Fabrice Bellard's minimalistic JavaScript engine https://github.com/bellard/quickjs

Defined Under Namespace

Classes: MissingQuickjs

Class Method Summary collapse

Class Method Details

.call(data) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'opal/lib/opal/cli_runners/quickjs.rb', line 12

def self.call(data)
  exe = ENV['QJS_PATH'] || 'qjs'

  opts = Shellwords.shellwords(ENV['QJS_OPTS'] || '')

  SystemRunner.call(data) do |tempfile|
    [exe, '--std', *opts, tempfile.path, *data[:argv]]
  end
rescue Errno::ENOENT
  raise MissingQuickjs, 'Please install QuickJS to be able to run Opal scripts.'
end