Skip to content

Commit

Permalink
fix: Temp file creation catches realpath error
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 committed Jul 30, 2024
1 parent 01cbf9e commit caa54f3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/back/util/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,13 @@ export function getCwd(isDev: boolean, exePath: string) {
}

export async function getTempFilename(ext = 'tmp') {
return path.join(await fs.promises.realpath(os.tmpdir()), uuid() + '.' + ext);
let tempDir;
try {
tempDir = await fs.promises.realpath(os.tmpdir());
} catch {
tempDir = os.tmpdir();
}
return path.join(tempDir, uuid() + '.' + ext);
}

/**
Expand Down

0 comments on commit caa54f3

Please sign in to comment.