1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Consolidate basic JS runners

This commit is contained in:
Sam Stephenson 2011-02-06 20:46:39 -06:00
parent 3652589056
commit 210ce211a0
4 changed files with 3 additions and 39 deletions

View file

@ -19,7 +19,7 @@ module ExecJS
define_runtime :V8,
:command => "v8",
:runner_path => runner_path("v8.js")
:runner_path => runner_path("basic.js")
define_runtime :Node,
:command => "node",
@ -27,10 +27,10 @@ module ExecJS
define_runtime :JSC,
:command => "/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc",
:runner_path => runner_path("jsc.js")
:runner_path => runner_path("basic.js")
define_runtime :Spidermonkey,
:command => "js",
:runner_path => runner_path("spidermonkey.js")
:runner_path => runner_path("basic.js")
end
end

View file

@ -1,18 +0,0 @@
(function(program, execJS) { execJS(program) })(function() { #{source}
}, function(program) {
var output;
try {
result = program();
if (typeof result == 'undefined' && result !== null) {
print('["ok"]');
} else {
try {
print(JSON.stringify(['ok', result]));
} catch (err) {
print('["err"]');
}
}
} catch (err) {
print(JSON.stringify(['err', '' + err]));
}
});

View file

@ -1,18 +0,0 @@
(function(program, execJS) { execJS(program) })(function() { #{source}
}, function(program) {
var output;
try {
result = program();
if (typeof result == 'undefined' && result !== null) {
print('["ok"]');
} else {
try {
print(JSON.stringify(['ok', result]));
} catch (err) {
print('["err"]');
}
}
} catch (err) {
print(JSON.stringify(['err', '' + err]));
}
});