diff options
Diffstat (limited to 'src')
-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]; |