From 16d08db683538b82efcde288db7ec2224fdfd1cd Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sun, 9 Sep 2012 10:18:06 -0700 Subject: clean up handling of initial run --- src/postamble.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/postamble.js') diff --git a/src/postamble.js b/src/postamble.js index 50db3c30..d164f049 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -32,6 +32,11 @@ Module.callMain = function callMain(args) { function run(args) { args = args || Module['arguments']; + if (runDependencies > 0) { + Module.printErr('run() called, but dependencies remain, so not running'); + return 0; + } + if (Module['preRun']) { if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; var toRun = Module['preRun']; @@ -91,14 +96,15 @@ if (Module['preInit']) { initRuntime(); #if INVOKE_RUN +var shouldRunNow = true; #else -addRunDependency(); +var shouldRunNow = false; #endif if (Module['noInitialRun']) { - addRunDependency(); + shouldRunNow = false; } -if (runDependencies == 0) { +if (shouldRunNow) { var ret = run(); #if CATCH_EXIT_CODE Module.print('Exit Status: ' + ret); -- cgit v1.2.3-18-g5258