summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/server/loop.js31
-rw-r--r--share/server/state.js1
2 files changed, 19 insertions, 13 deletions
diff --git a/share/server/loop.js b/share/server/loop.js
index ff241eed..33e87c98 100644
--- a/share/server/loop.js
+++ b/share/server/loop.js
@@ -12,19 +12,24 @@
var sandbox = null;
-try {
- // if possible, use evalcx (not always available)
- sandbox = evalcx('');
- sandbox.emit = emit;
- sandbox.sum = sum;
- sandbox.log = log;
- sandbox.toJSON = toJSON;
- sandbox.provides = provides;
- sandbox.registerType = registerType;
- sandbox.start = start;
- sandbox.send = send;
- sandbox.getRow = getRow;
-} catch (e) {}
+var init_sandbox = function() {
+ try {
+ // if possible, use evalcx (not always available)
+ sandbox = evalcx('');
+ sandbox.emit = emit;
+ sandbox.sum = sum;
+ sandbox.log = log;
+ sandbox.toJSON = toJSON;
+ sandbox.provides = provides;
+ sandbox.registerType = registerType;
+ sandbox.start = start;
+ sandbox.send = send;
+ sandbox.getRow = getRow;
+ } catch (e) {
+ log(toJSON(e));
+ }
+};
+init_sandbox();
// Commands are in the form of json arrays:
// ["commandname",..optional args...]\n
diff --git a/share/server/state.js b/share/server/state.js
index aacd8ab1..b9bd87aa 100644
--- a/share/server/state.js
+++ b/share/server/state.js
@@ -21,6 +21,7 @@ var State = (function() {
funs = [];
funsrc = [];
query_config = config;
+ init_sandbox();
gc();
print("true"); // indicates success
},