From 954374861d1dd5abaf036696b9c2a474ca26f527 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Thu, 16 Dec 2021 19:06:33 -0800 Subject: [PATCH] fs: Limit random tmp suffix to 8 digits --- src/util/fs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/fs.ts b/src/util/fs.ts index bc3e1fe..b13de26 100644 --- a/src/util/fs.ts +++ b/src/util/fs.ts @@ -37,7 +37,7 @@ export async function exists(path: string) { export async function withTempDir(callback: (tmp: TempState) => Promise) { let tmp = os.tmpdir() - let rand = `${Math.random()}`.slice(2) + let rand = `${Math.random()}`.slice(2, 10) let dir = `${tmp}/${TMP_PREFIX}${rand}` await fs.rm(dir, { force: true, recursive: true })