aboutsummaryrefslogtreecommitdiff
path: root/src/postamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/postamble.js')
-rw-r--r--src/postamble.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/postamble.js b/src/postamble.js
index 63495914..90a86474 100644
--- a/src/postamble.js
+++ b/src/postamble.js
@@ -117,17 +117,17 @@ function run(args) {
preRun();
- if (runDependencies > 0) {
- // a preRun added a dependency, run will be called later
- return;
- }
+ if (runDependencies > 0) return; // a preRun added a dependency, run will be called later
+ if (Module['calledRun']) return; // run may have just been called through dependencies being fulfilled just in this very frame
function doRun() {
+ if (Module['calledRun']) return; // run may have just been called while the async setStatus time below was happening
+ Module['calledRun'] = true;
+
ensureInitRuntime();
preMain();
- Module['calledRun'] = true;
if (Module['_main'] && shouldRunNow) {
Module['callMain'](args);
}