diff --git a/prelude/bootstrap.js b/prelude/bootstrap.js index 2f85f902..93ab1e79 100644 --- a/prelude/bootstrap.js +++ b/prelude/bootstrap.js @@ -1722,12 +1722,16 @@ function payloadFileSync(pointer) { fs.promises.stat = util.promisify(fs.stat); fs.promises.lstat = util.promisify(fs.lstat); - /* fs.promises.read = util.promisify(fs.read); fs.promises.realpath = util.promisify(fs.realpath); fs.promises.fstat = util.promisify(fs.fstat); + fs.promises.statfs = util.promisify(fs.fstat); fs.promises.access = util.promisify(fs.access); - */ + + // TODO: all promises methods that try to edit files in snapshot should throw + // TODO implement missing methods + // fs.promises.readlink ? + // fs.promises.opendir ? } // /////////////////////////////////////////////////////////////// diff --git a/prelude/diagnostic.js b/prelude/diagnostic.js index 64acac20..22201a58 100644 --- a/prelude/diagnostic.js +++ b/prelude/diagnostic.js @@ -80,7 +80,7 @@ function humanSize(bytes) { return totalSize; } function wrap(obj, name) { - const f = fs[name]; + const f = obj[name]; obj[name] = (...args) => { const args1 = Object.values(args); console.log( @@ -111,6 +111,7 @@ function humanSize(bytes) { wrap(fs, 'open'); wrap(fs, 'readSync'); wrap(fs, 'read'); + wrap(fs, 'readFile'); wrap(fs, 'writeSync'); wrap(fs, 'write'); wrap(fs, 'closeSync'); @@ -131,6 +132,18 @@ function humanSize(bytes) { wrap(fs, 'exists'); wrap(fs, 'accessSync'); wrap(fs, 'access'); + + wrap(fs.promises, 'open'); + wrap(fs.promises, 'read'); + wrap(fs.promises, 'readFile'); + wrap(fs.promises, 'write'); + wrap(fs.promises, 'readdir'); + wrap(fs.promises, 'realpath'); + wrap(fs.promises, 'stat'); + wrap(fs.promises, 'lstat'); + wrap(fs.promises, 'fstat'); + wrap(fs.promises, 'access'); + wrap(fs.promises, 'copyFile'); } } })();