aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-05-12 15:10:11 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-05-12 15:10:11 -0700
commitd2f680e7a4eee462dd487e6482c8ee4c27f7c6bb (patch)
tree9f785c58fbda93fe96946513587b195ed0342668 /src
parent4fe256e2571b288e98fe81d20eb37f9fba1006f0 (diff)
clean up shell.js
Diffstat (limited to 'src')
-rw-r--r--src/postamble.js9
-rw-r--r--src/shell.js11
2 files changed, 17 insertions, 3 deletions
diff --git a/src/postamble.js b/src/postamble.js
index cb0521aa..4943b9e8 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -21,6 +21,8 @@ Module.callMain = function callMain(args) {
}
function run(args) {
+ args = args || Module.arguments;
+
__initializeRuntime__();
var globalFuncs = [];
@@ -39,8 +41,13 @@ Module['run'] = run;
// {{PRE_RUN_ADDITIONS}}
#if INVOKE_RUN
-run(args);
+#else
+Module.noInitialRun = true;
#endif
+if (!Module.noInitialRun) {
+ run();
+}
+
// {{POST_RUN_ADDITIONS}}
diff --git a/src/shell.js b/src/shell.js
index 3b762e18..f18fc3ca 100644
--- a/src/shell.js
+++ b/src/shell.js
@@ -6,8 +6,15 @@
// args = args || [];
// Runs much faster, for some reason
-this['Module'] = {};
-var args = arguments;
+if (!this['Module']) {
+ this['Module'] = {};
+}
+try {
+ Module.arguments = arguments;
+} catch(e) {
+ Module.arguments = [];
+}
+
{{BODY}}
// {{MODULE_ADDITIONS}}