diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-09 20:34:37 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-09 20:34:37 -0700 |
commit | f58e77da332cb0f8123c0c062c275c63783736a7 (patch) | |
tree | 518251ccf13fd13e62604306f0e121034a79f82d /src/postamble.js | |
parent | 064206f86c62c546b1860cb14e4f303b6056b5bc (diff) |
make noInitialRun and INVOKE_RUN refer to main(), not run(). run() need not call main(), and is necessary to set things up even if you call main() manually
Diffstat (limited to 'src/postamble.js')
-rw-r--r-- | src/postamble.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/postamble.js b/src/postamble.js index ea520eae..8dd01589 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -3,6 +3,7 @@ Module.callMain = function callMain(args) { assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on __ATMAIN__)'); + assert(!Module['preRun'] || Module['preRun'].length == 0, 'cannot call main when preRun functions remain to be called'); args = args || []; @@ -82,7 +83,7 @@ function run(args) { var ret = 0; calledRun = true; - if (Module['_main']) { + if (Module['_main'] && shouldRunNow) { ret = Module.callMain(args); if (!Module['noExitRuntime']) { exitRuntime(); @@ -121,6 +122,7 @@ if (Module['preInit']) { } } +// shouldRunNow refers to calling main(), not run(). #if INVOKE_RUN var shouldRunNow = true; #else @@ -130,9 +132,7 @@ if (Module['noInitialRun']) { shouldRunNow = false; } -if (shouldRunNow) { - run(); -} +run(); // {{POST_RUN_ADDITIONS}} |