Skip to content

Commit 686a01e

Browse files
authored
fix node patches in node 20.12
1 parent 04d179e commit 686a01e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

internal/node/node_patches.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ function patcher$1(fs = fs__namespace, roots) {
216216
return str;
217217
};
218218
fs.readdir = (...args) => {
219-
const p = path__namespace.resolve(args[0]);
219+
const p = path__namespace.resolve(
220+
// node 20.12 tightened the constraints and requires the input to be a string
221+
String(args[0]),
222+
);
220223
let cb = args[args.length - 1];
221224
if (typeof cb !== 'function') {
222225
// this will likely throw callback required error.
@@ -247,7 +250,10 @@ function patcher$1(fs = fs__namespace, roots) {
247250
};
248251
fs.readdirSync = (...args) => {
249252
const res = origReaddirSync(...args);
250-
const p = path__namespace.resolve(args[0]);
253+
const p = path__namespace.resolve(
254+
// node 20.12 tightened the constraints and requires the input to be a string
255+
String(args[0]),
256+
);
251257
res.forEach((v) => {
252258
handleDirentSync(p, v);
253259
});

0 commit comments

Comments
 (0)