Skip to content

Commit

Permalink
Read all results for subdirectories in opendir
Browse files Browse the repository at this point in the history
Fixes #48820
  • Loading branch information
mdouglass committed Jul 18, 2023
1 parent b361ad7 commit 11cedfe
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/internal/fs/dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,22 @@ class Dir {
pathModule.toNamespacedPath(dirent.path),
this[kDirOptions].encoding,
undefined,
ctx,
ctx
);
handleErrorFromBinding(ctx);
const result = handle.read(
this[kDirOptions].encoding,
this[kDirOptions].bufferSize,
undefined,
ctx,
);
while (true) {
const result = handle.read(
this[kDirOptions].encoding,
this[kDirOptions].bufferSize,
undefined,
ctx,
);

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

handle.close(undefined, ctx);
Expand Down Expand Up @@ -206,7 +210,7 @@ class Dir {
this[kDirOptions].encoding,
this[kDirOptions].bufferSize,
undefined,
ctx,
ctx
);
handleErrorFromBinding(ctx);

Expand Down

0 comments on commit 11cedfe

Please sign in to comment.