Skip to content

fix(hub): keep shim dir off the child cwd so Windows cleanup can rmdir - #409

Merged
antfu merged 1 commit into
mainfrom
fix/windows-terminals-cwd-ebusy
Sep 25, 2026
Merged

antfu merged 1 commit into
mainfrom
fix/windows-terminals-cwd-ebusy

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Why

Follow-up to #408. The retry added there downgraded the Windows unit-test failure from EPERM to EBUSY but did not fix it:

Error: EBUSY: resource busy or locked, rmdir 'C:\Users\RUNNER~1\AppData\Local\Temp\devframe-terminals-shim-...'
 ❯ cleanup src/node/__tests__/host-terminals.test.ts

EBUSY on the rmdir syscall for the temp dir itself (not a file inside it) means a process in the tree still holds that directory as its current working directory. The shim session spawns the child with cwd: dir, so Windows keeps dir locked, and no amount of retrying clears a held cwd.

What

The .cmd shim resolves child.cjs through %~dp0 (an absolute path), so the child needs no cwd of its own. Spawn it from the parent temp dir (tmpdir()) instead of the shim's own dir, so nothing holds the dir open and the later rmdir succeeds. The existing retry still covers transient file-handle release for the files inside.

Test-only change; no runtime behaviour changes.

This PR was created with the help of an agent.

@coldtea-pr-lens

Copy link
Copy Markdown

◈ PR Lens

Note

Only tests changed, so PR Lens left this pull request undrawn. Comment @pr-lens draw to draw it

github.comment.notice: false in .github/pr-lens.yml turns this note off

@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
devframe Skipped Skipped Sep 25, 2026 2:50am UTC

@antfu
antfu merged commit 3b01dd2 into main Sep 25, 2026
13 checks passed
@antfu
antfu deleted the fix/windows-terminals-cwd-ebusy branch September 25, 2026 03:02

This branch was previously deployed

1 inactive deployment
Preview — 2e562b59 Deployed Sep 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants