From 4c46b5aabd4d730b6e029cc523ec5b6546aafdc6 Mon Sep 17 00:00:00 2001 From: "Anthony Fu (via agent)" Date: Fri, 25 Sep 2026 02:03:14 +0000 Subject: [PATCH] fix(hub): retry temp-dir cleanup on Windows to avoid EPERM --- packages/hub/src/node/__tests__/host-terminals.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hub/src/node/__tests__/host-terminals.test.ts b/packages/hub/src/node/__tests__/host-terminals.test.ts index e14b965b..97debcf1 100644 --- a/packages/hub/src/node/__tests__/host-terminals.test.ts +++ b/packages/hub/src/node/__tests__/host-terminals.test.ts @@ -430,7 +430,9 @@ describe.runIf(process.platform === 'win32')('devframeTerminalHost child-process }, 10_000) // The host holds the `cmd.exe` wrapper, not the node child. expect(session.getChildProcess()?.pid).not.toBe(pid) - return { session, pid, cleanup: () => rmSync(dir, { recursive: true, force: true }) } + // Windows releases the killed process's file handles asynchronously, so an + // immediate `rm` can still hit EPERM; retry until the handles are gone. + return { session, pid, cleanup: () => rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }) } } it('terminate() kills the process started by a .cmd shim', async () => {