mirror of
https://github.com/rails/execjs
synced 2023-03-27 23:21:20 -04:00
20 lines
670 B
JavaScript
20 lines
670 B
JavaScript
(function(program, execJS) { execJS(program) })(function(global, module, exports, require, console, setTimeout, setInterval, clearTimeout, clearInterval, setImmediate, clearImmediate) { #{source}
|
|
}, function(program) {
|
|
var output, print = function(string) {
|
|
process.stdout.write('' + string);
|
|
};
|
|
try {
|
|
result = program();
|
|
if (typeof result == 'undefined' && result !== null) {
|
|
print('["ok"]');
|
|
} else {
|
|
try {
|
|
print(JSON.stringify(['ok', result]));
|
|
} catch (err) {
|
|
print(JSON.stringify(['err', '' + err, err.stack]));
|
|
}
|
|
}
|
|
} catch (err) {
|
|
print(JSON.stringify(['err', '' + err, err.stack]));
|
|
}
|
|
});
|