diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library.js | 8 | ||||
-rw-r--r-- | src/postamble.js | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js index 8de71659..5587ca3e 100644 --- a/src/library.js +++ b/src/library.js @@ -26,8 +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__.push({ func: function() { FS.ignorePermissions = false; if (!FS.init.initialized) FS.init() } });' + '__ATEXIT__.push({ func: function() { FS.quit() } });', $FS: { // The path to the current folder. @@ -343,7 +342,7 @@ LibraryManager.library = { FS.createFolder('/', 'tmp', true, true); // Create the I/O devices. - var devFolder = FS.createFolder('/', 'dev', true, false); + var devFolder = FS.createFolder('/', 'dev', true, true); var stdin = FS.createDevice(devFolder, 'stdin', input); var stdout = FS.createDevice(devFolder, 'stdout', null, output); var stderr = FS.createDevice(devFolder, 'stderr', null, error); @@ -387,6 +386,9 @@ LibraryManager.library = { _stdout = allocate([2], 'void*', ALLOC_STATIC); _stderr = allocate([3], 'void*', ALLOC_STATIC); + // Other system paths + FS.createPath('/', 'dev/shm/tmp', true, true); // temp files + // Newlib initialization FS.streams[_stdin] = FS.streams[1]; FS.streams[_stdout] = FS.streams[2]; diff --git a/src/postamble.js b/src/postamble.js index ada13016..390f9f27 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -45,6 +45,10 @@ Module['run'] = run; // {{PRE_RUN_ADDITIONS}} +if (Module['preRun']) { + Module['preRun'](); +} + #if INVOKE_RUN #else Module['noInitialRun'] = true; @@ -59,3 +63,7 @@ if (!Module['noInitialRun']) { // {{POST_RUN_ADDITIONS}} +if (Module['postRun']) { + Module['postRun'](); +} + |