module Yarnlock::JsExecutor

Public Class Methods

execute(script, stdin) click to toggle source
# File lib/yarnlock/js_executor.rb, line 5
def self.execute(script, stdin)
  IO.popen(script_path(script), 'r+') do |io|
    io.puts stdin
    io.close_write
    io.gets
  end
end
script_path(script) click to toggle source
# File lib/yarnlock/js_executor.rb, line 13
def self.script_path(script)
  "#{Yarnlock.config.node_path} #{Yarnlock.config.script_dir}/#{script}"
end