From cbf67e2308d87ab887a62b1fb22e7429107e3bdb Mon Sep 17 00:00:00 2001 From: Alex Gherghisan Date: Thu, 20 Feb 2025 18:22:38 +0000 Subject: [PATCH] fix: retry rm operation in cleanup Fix #12141 --- yarn-project/foundation/src/fs/run_in_dir.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yarn-project/foundation/src/fs/run_in_dir.ts b/yarn-project/foundation/src/fs/run_in_dir.ts index 5bd47da89754..2eb4d6f02552 100644 --- a/yarn-project/foundation/src/fs/run_in_dir.ts +++ b/yarn-project/foundation/src/fs/run_in_dir.ts @@ -20,7 +20,11 @@ export async function runInDirectory( throw err; } finally { if (!skipCleanup) { - await fs.rm(workingDirectory, { recursive: true, force: true }); + try { + await fs.rm(workingDirectory, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }); + } catch { + // ignore cleanup errors + } } } }