diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-02-05 13:50:08 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-02-05 13:50:08 -0800 |
commit | 05757398ff2da3df3867aeb70ed83a98d273a405 (patch) | |
tree | 51412f6b69d9225903093c32f9b4d11b682e57e6 | |
parent | c161ef0fe82c320b367bc29cd1ba14cd9f90206e (diff) |
do ATINIT and ATEXIT in order
-rw-r--r-- | src/library.js | 2 | ||||
-rw-r--r-- | src/preamble.js | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js index 5587ca3e..4096ba75 100644 --- a/src/library.js +++ b/src/library.js @@ -26,7 +26,7 @@ LibraryManager.library = { _impure_ptr: 0, $FS__deps: ['$ERRNO_CODES', '__setErrNo', 'stdin', 'stdout', 'stderr', '_impure_ptr'], - $FS__postset: '__ATINIT__.push({ func: function() { FS.ignorePermissions = false; if (!FS.init.initialized) FS.init() } });' + + $FS__postset: '__ATINIT__.unshift({ func: function() { FS.ignorePermissions = false; if (!FS.init.initialized) FS.init() } });' + '__ATEXIT__.push({ func: function() { FS.quit() } });', $FS: { // The path to the current folder. diff --git a/src/preamble.js b/src/preamble.js index 8dd2c39d..e957c212 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -671,7 +671,7 @@ STATICTOP = alignMemoryPage(STACK_MAX); function callRuntimeCallbacks(callbacks) { while(callbacks.length > 0) { - var callback = callbacks.pop(); + var callback = callbacks.shift(); var func = callback.func; if (typeof func === 'number') { func = FUNCTION_TABLE[func]; |