Open mziyut opened 1 year ago
Node = ExternalRuntime.new(
name: "Node.js (V8)",
command: ["node", "nodejs"],
runner_path: ExecJS.root + "/support/node_runner.js",
encoding: 'UTF-8'
)
def root
@root ||= File.expand_path("..", __FILE__)
end
(function(program, execJS) { execJS(program) })(function(global, process, module, exports, require, console, setTimeout, setInterval, clearTimeout, clearInterval, setImmediate, clearImmediate) { #{source}
}, function(program) {
var __process__ = process;
var printFinal = function(string) {
process.stdout.write('' + string, function() {
__process__.exit(0);
});
};
try {
delete this.process;
delete this.console;
delete this.setTimeout;
delete this.setInterval;
delete this.clearTimeout;
delete this.clearInterval;
delete this.setImmediate;
delete this.clearImmediate;
result = program();
this.process = __process__;
if (typeof result == 'undefined' && result !== null) {
printFinal('["ok"]');
} else {
try {
printFinal(JSON.stringify(['ok', result]));
} catch (err) {
printFinal(JSON.stringify(['err', '' + err, err.stack]));
}
}
} catch (err) {
this.process = __process__;
printFinal(JSON.stringify(['err', '' + err, err.stack]));
}
});
GitHubRun JavaScript code from Ruby. Contribute to rails/execjs development by creating an account on GitHub.
GitHubRun JavaScript code from Ruby. Contribute to rails/execjs development by creating an account on GitHub.
GitHubRun JavaScript code from Ruby. Contribute to rails/execjs development by creating an account on GitHub.
https://github.com/rails/execjs