Skip to content

Commit

Permalink
fs: resolve error in test-fs-opendir-recursive.js
Browse files Browse the repository at this point in the history
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 #49603.

Refs: #49603
  • Loading branch information
sonny authored and sonny committed Jul 21, 2024
1 parent ca85a0d commit 9d97bac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/internal/fs/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ class Dir {
}

readSyncRecursive(dirent) {
const ctx = { path: dirent.path };
const path = pathModule.join(dirent.path, dirent.name);
const ctx = { path };
const handle = dirBinding.opendir(
pathModule.toNamespacedPath(dirent.path),
pathModule.toNamespacedPath(path),
this[kDirOptions].encoding,
undefined,
ctx,
Expand All @@ -177,7 +178,7 @@ class Dir {
);

if (result) {
this.processReadResult(dirent.path, result);
this.processReadResult(path, result);
}

handle.close(undefined, ctx);
Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-fs-opendir-recursive.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ for (let i = 0; i < expected.length; i++) {
}

function getDirentPath(dirent) {
return pathModule.relative(testDir, dirent.path);
return pathModule.relative(testDir, pathModule.join(dirent.path, dirent.name));
}

function assertDirents(dirents) {
Expand Down

0 comments on commit 9d97bac

Please sign in to comment.