Skip to content

Commit 77977ef

Browse files
committed
fix: add directory check in cleanup to prevent deleting files
1 parent c3a4bad commit 77977ef

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

check-bun-node.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,15 @@ async function cleanup() {
644644
const glob = new Bun.Glob("*");
645645
for await (const folder of glob.scan({ cwd: absoluteDir, absolute: false, onlyFiles: false })) {
646646
if (!supportedMajors.includes(folder)) {
647-
await rm(join(absoluteDir, folder), { recursive: true, force: true });
647+
const folderPath = join(absoluteDir, folder);
648+
try {
649+
const stats = await (await import("node:fs/promises")).stat(folderPath);
650+
if (stats.isDirectory()) {
651+
await rm(folderPath, { recursive: true, force: true });
652+
}
653+
} catch (e) {
654+
// Ignore errors (e.g., file does not exist)
655+
}
648656
}
649657
}
650658
}

0 commit comments

Comments
 (0)