diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library_fs.js | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/library_fs.js b/src/library_fs.js index 8f68b395..5adbe6b7 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -27,22 +27,7 @@ mergeInto(LibraryManager.library, { // to modify the filesystem freely before run() is called. ignorePermissions: true, - ErrnoError: (function() { - function ErrnoError(errno) { - this.errno = errno; - for (var key in ERRNO_CODES) { - if (ERRNO_CODES[key] === errno) { - this.code = key; - break; - } - } - this.message = ERRNO_MESSAGES[errno]; - this.stack = stackTrace(); - }; - ErrnoError.prototype = new Error(); - ErrnoError.prototype.constructor = ErrnoError; - return ErrnoError; - }()), + ErrnoError: null, // set during init handleFSError: function(e) { if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace(); @@ -1092,6 +1077,20 @@ mergeInto(LibraryManager.library, { assert(!FS.init.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)'); FS.init.initialized = true; + FS.ErrnoError = function ErrnoError(errno) { + this.errno = errno; + for (var key in ERRNO_CODES) { + if (ERRNO_CODES[key] === errno) { + this.code = key; + break; + } + } + this.message = ERRNO_MESSAGES[errno]; + this.stack = stackTrace(); + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here Module['stdin'] = input || Module['stdin']; Module['stdout'] = output || Module['stdout']; |