diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-02-05 13:33:20 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-02-05 13:33:20 -0800 |
commit | c161ef0fe82c320b367bc29cd1ba14cd9f90206e (patch) | |
tree | ada0a2ed3c1304d285a885684e293c7e9dab8c2d /src/library.js | |
parent | b8a79ced1fa51e6feb772702057375b71344f5e5 (diff) |
add preRun and postRun hooks in Module, and tweak FS initialization
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 8 |
1 files changed, 5 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]; |