From 352bf539604d945d8957b9c7b09a2e55fb5a3c66 Mon Sep 17 00:00:00 2001 From: JF Date: Wed, 7 Oct 2026 13:54:09 -0400 Subject: [PATCH] test(go): leave the noDebug fixture's temp dir to the OS when rmdir stays EBUSY (#866) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "reports the exit code under noDebug" case removed its temp directory in a finally with rmSync's 10 x 200 ms retry, and on windows-latest that was twice not enough (run 37406647101 for PR #862, run 37653235241 for PR #868): Delve holds the exited debuggee's image until its own exit, which the session's close does not wait for, and the EBUSY failed a test whose debugging part had passed — taking the Windows job with it. A cleanup EBUSY/EPERM is now logged and the directory left under the temp dir for the OS, the way mcp-server-self-debug.test.ts already treats its inner dir; any other error still throws. Co-Authored-By: Claude Fable 5.1 --- tests/adapters/go/integration/go-exit-code.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/adapters/go/integration/go-exit-code.test.ts b/tests/adapters/go/integration/go-exit-code.test.ts index d86f1408..0e482ec2 100644 --- a/tests/adapters/go/integration/go-exit-code.test.ts +++ b/tests/adapters/go/integration/go-exit-code.test.ts @@ -124,7 +124,18 @@ describe.skipIf(!hasGo)('Go exit code from Delve\'s console status line (issue # } finally { // On Windows the exited debuggee's image can stay locked for a moment after the session // ends, so the first rmdir may hit EBUSY; rmSync retries EBUSY/EPERM with these options. - fs.rmSync(tmp, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 }); + // When even that is not enough (issue #866: Delve holds the image until its own exit, + // which the session's close does not wait for), the directory is left to the OS — it is + // under the temp dir, and a cleanup failure must not fail a test whose debugging passed. + try { + fs.rmSync(tmp, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 }); + } catch (err) { + const code = (err as NodeJS.ErrnoException).code; + if (code !== 'EBUSY' && code !== 'EPERM') { + throw err; + } + console.warn(`[go-exit-code] leaving ${tmp} to the OS: rmdir hit ${code} (issue #866)`); + } } }, 90_000); });