From cfc9a9a601e781b006ccb8bfd8330ee933c11690 Mon Sep 17 00:00:00 2001 From: zhizheng Date: Thu, 10 Jul 2025 16:09:16 +0800 Subject: [PATCH] chore: ensures more stable CI runs on Windows environments. (#3070) This pull request includes a small but important change to the `withTmpDir` function in `src/test_utils.ts`. The change adds error handling to ensure that a `PermissionDenied` error during directory removal does not interrupt the execution. --- src/test_utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test_utils.ts b/src/test_utils.ts index 74217d0b..9de45842 100644 --- a/src/test_utils.ts +++ b/src/test_utils.ts @@ -125,7 +125,13 @@ export async function withTmpDir( return { dir, async [Symbol.asyncDispose]() { - await Deno.remove(dir, { recursive: true }); + try { + await Deno.remove(dir, { recursive: true }); + } catch (error) { + if (!(error instanceof Deno.errors.PermissionDenied)) { + throw error; + } + } }, }; }