aboutsummaryrefslogtreecommitdiff
path: root/src/shell.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell.js')
-rw-r--r--src/shell.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/shell.js b/src/shell.js
index e48be3b0..891a6328 100644
--- a/src/shell.js
+++ b/src/shell.js
@@ -46,7 +46,7 @@ if (ENVIRONMENT_IS_NODE) {
}
} else if (ENVIRONMENT_IS_SHELL) {
Module['print'] = print;
- Module['printErr'] = printErr;
+ if (typeof printErr != 'undefined') Module['printErr'] = printErr; // not present in v8 or older sm
// Polyfill over SpiderMonkey/V8 differences
if (typeof read != 'undefined') {
@@ -104,11 +104,11 @@ if (!Module['load'] == 'undefined' && Module['read']) {
globalEval(Module['read'](f));
};
}
-if (!Module['printErr']) {
- Module['printErr'] = function(){};
-}
if (!Module['print']) {
- Module['print'] = Module['printErr'];
+ Module['print'] = function(){};
+}
+if (!Module['printErr']) {
+ Module['printErr'] = Module['print'];
}
if (!Module['arguments']) {
Module['arguments'] = [];
@@ -119,6 +119,10 @@ if (!Module['arguments']) {
Module.print = Module['print'];
Module.printErr = Module['printErr'];
+// Callbacks
+if (!Module['preRun']) Module['preRun'] = [];
+if (!Module['postRun']) Module['postRun'] = [];
+
{{BODY}}
// {{MODULE_ADDITIONS}}