Skip to content

Commit 5ce4300

Browse files
committed
Use isSystemError in createTemporaryFile
1 parent 4ed7be8 commit 5ce4300

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

workspaces/util/src/createTemporaryFile.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { constants } from "node:fs";
22
import { open as openFile, type FileHandle } from "node:fs/promises";
33

44
import { getRandomBytes } from "@code-chronicles/util/getRandomBytes";
5+
import { isSystemError } from "@code-chronicles/util/isSystemError";
56

67
export async function createTemporaryFile(
78
prefix: string = "",
@@ -29,7 +30,7 @@ export async function createTemporaryFile(
2930
try {
3031
// We won the lottery and came up with a temporary file name that
3132
// already exists. Try again?
32-
if ((e as { code: string }).code === "EEXIST") {
33+
if (isSystemError(e) && e.code === "EEXIST") {
3334
continue;
3435
}
3536
} catch {}

0 commit comments

Comments
 (0)