Skip to content

test: avoid EBUSY removing renamed host executable - #3381

Open
gengjiawen wants to merge 1 commit into
nodejs:mainfrom
gengjiawen:test/renamed-host-ebusy
Open

gengjiawen wants to merge 1 commit into
nodejs:mainfrom
gengjiawen:test/renamed-host-ebusy

Conversation

@gengjiawen

Copy link
Copy Markdown
Member
Checklist
  • npm install && npm run lint && npm test passes
  • commit message follows commit guidelines
Description of change

addon works with renamed host executable intermittently fails on Windows (both windows-11-arm and windows-latest), e.g. this job:

Error: EBUSY: resource busy or locked, unlink 'C:\Users\RUNNER~1\AppData\Local\Temp\notnode.exe'
    at Object.unlinkSync (node:fs:2405:11)
    at Context.<anonymous> (test\test-addon.js:157:8)

The test copies node to a fixed path in the temp directory and unlinks it right after running it; on Windows the just-exited executable can still be locked. The unlink also wasn't in a finally, so a failed build left the file behind.

The test now uses a fresh mkdtemp directory and removes it in finally with maxRetries: 3, retryDelay: 1000, matching the rm calls in test-install.js.

"addon works with renamed host executable" copied node to a fixed path in
the temp directory and unlinked it right after running it. On Windows the
just-exited executable can still be locked, which intermittently failed
the test with "EBUSY: resource busy or locked, unlink ...notnode.exe".

Use a fresh temp directory and remove it in a finally block with
retries, like the other cleanups in the test suite.
@gengjiawen gengjiawen mentioned this pull request Sep 30, 2026
3 tasks done
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.

1 participant