Skip to content

Commit 93fed60

Browse files
authored
fix: missing fs/promises patches to resolve Not found error (#124)
1 parent 8913dff commit 93fed60

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

prelude/bootstrap.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,12 +1722,16 @@ function payloadFileSync(pointer) {
17221722
fs.promises.stat = util.promisify(fs.stat);
17231723
fs.promises.lstat = util.promisify(fs.lstat);
17241724

1725-
/*
17261725
fs.promises.read = util.promisify(fs.read);
17271726
fs.promises.realpath = util.promisify(fs.realpath);
17281727
fs.promises.fstat = util.promisify(fs.fstat);
1728+
fs.promises.statfs = util.promisify(fs.fstat);
17291729
fs.promises.access = util.promisify(fs.access);
1730-
*/
1730+
1731+
// TODO: all promises methods that try to edit files in snapshot should throw
1732+
// TODO implement missing methods
1733+
// fs.promises.readlink ?
1734+
// fs.promises.opendir ?
17311735
}
17321736

17331737
// ///////////////////////////////////////////////////////////////

prelude/diagnostic.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function humanSize(bytes) {
8080
return totalSize;
8181
}
8282
function wrap(obj, name) {
83-
const f = fs[name];
83+
const f = obj[name];
8484
obj[name] = (...args) => {
8585
const args1 = Object.values(args);
8686
console.log(
@@ -111,6 +111,7 @@ function humanSize(bytes) {
111111
wrap(fs, 'open');
112112
wrap(fs, 'readSync');
113113
wrap(fs, 'read');
114+
wrap(fs, 'readFile');
114115
wrap(fs, 'writeSync');
115116
wrap(fs, 'write');
116117
wrap(fs, 'closeSync');
@@ -131,6 +132,18 @@ function humanSize(bytes) {
131132
wrap(fs, 'exists');
132133
wrap(fs, 'accessSync');
133134
wrap(fs, 'access');
135+
136+
wrap(fs.promises, 'open');
137+
wrap(fs.promises, 'read');
138+
wrap(fs.promises, 'readFile');
139+
wrap(fs.promises, 'write');
140+
wrap(fs.promises, 'readdir');
141+
wrap(fs.promises, 'realpath');
142+
wrap(fs.promises, 'stat');
143+
wrap(fs.promises, 'lstat');
144+
wrap(fs.promises, 'fstat');
145+
wrap(fs.promises, 'access');
146+
wrap(fs.promises, 'copyFile');
134147
}
135148
}
136149
})();

0 commit comments

Comments
 (0)