Skip to content

Commit d740bdb

Browse files
sonnysonsurim
sonny
authored andcommitted
fs: resolve error in test-fs-opendir-recursive.js
An error occurred in the test/sequential/test-fs-opendir-recursive.js file after changing the code. This was resolved by referring to the code resolved in PR nodejs#49603. Refs: nodejs#49603
1 parent 88dbf16 commit d740bdb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/internal/fs/dir.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ class Dir {
161161
}
162162

163163
readSyncRecursive(dirent) {
164-
const ctx = { path: dirent.path };
164+
const path = pathModule.join(dirent.path, dirent.name);
165+
const ctx = { path };
165166
const handle = dirBinding.opendir(
166-
pathModule.toNamespacedPath(dirent.path),
167+
pathModule.toNamespacedPath(path),
167168
this[kDirOptions].encoding,
168169
undefined,
169170
ctx,
@@ -177,7 +178,7 @@ class Dir {
177178
);
178179

179180
if (result) {
180-
this.processReadResult(dirent.path, result);
181+
this.processReadResult(path, result);
181182
}
182183

183184
handle.close(undefined, ctx);

test/sequential/test-fs-opendir-recursive.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ for (let i = 0; i < expected.length; i++) {
128128
}
129129

130130
function getDirentPath(dirent) {
131-
return pathModule.relative(testDir, dirent.path);
131+
return pathModule.relative(testDir, pathModule.join(dirent.path, dirent.name));
132132
}
133133

134134
function assertDirents(dirents) {

0 commit comments

Comments
 (0)