Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion workspaces/util/src/createTemporaryFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { constants } from "node:fs";
import { open as openFile, type FileHandle } from "node:fs/promises";

import { getRandomBytes } from "@code-chronicles/util/getRandomBytes";
import { isSystemError } from "@code-chronicles/util/isSystemError";

export async function createTemporaryFile(
prefix: string = "",
Expand Down Expand Up @@ -29,7 +30,7 @@ export async function createTemporaryFile(
try {
// We won the lottery and came up with a temporary file name that
// already exists. Try again?
if ((e as { code: string }).code === "EEXIST") {
if (isSystemError(e) && e.code === "EEXIST") {
continue;
}
} catch {}
Expand Down
Loading