Skip to content

Commit c5660b8

Browse files
betegonclaude
andcommitted
fix(init): remove double-close of Dir handle in walkDir
for-await-of auto-closes the Dir handle on completion (including break). The finally block was double-closing it, which throws ERR_DIR_CLOSED on Node.js (masked by Bun which silently succeeds). Matches the existing pattern in env-file.ts and project-root.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fc901d5 commit c5660b8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/lib/init/local-ops.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ async function walkDir(
411411
return;
412412
}
413413

414+
// No explicit handle.close() needed: for-await-of auto-closes the Dir
414415
try {
415416
for await (const entry of handle) {
416417
if (ctx.entries.length >= ctx.maxEntries) {
@@ -420,8 +421,6 @@ async function walkDir(
420421
}
421422
} catch {
422423
// Directory unreadable (ENOENT, EACCES, etc.) — skip gracefully
423-
} finally {
424-
await handle.close();
425424
}
426425
}
427426

0 commit comments

Comments
 (0)