fix: retry rename on Windows EPERM/EACCES/EBUSY during SSH config save#841
Merged
fix: retry rename on Windows EPERM/EACCES/EBUSY during SSH config save#841
Conversation
johnstcn
approved these changes
Mar 16, 2026
Member
johnstcn
left a comment
There was a problem hiding this comment.
LGTM but might be no harm to get a second pair of eyes.
On Windows, antivirus, Search Indexer, cloud sync, or concurrent processes can briefly lock files, causing fs.rename() to fail with EPERM, EACCES, or EBUSY when atomically replacing ~/.ssh/config or credential files. Add renameWithRetry() utility matching the strategy used by VS Code (pfs.ts) and graceful-fs: 60s wall-clock timeout with linear backoff (10ms increments, capped at 100ms). Only applies on Windows; other platforms call rename directly.
2cb3dce to
b40db7d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, antivirus, Search Indexer, cloud sync, or concurrent processes can briefly lock files, causing fs.rename() to fail with
EPERM,EACCES, orEBUSYwhen atomically replacing~/.ssh/configor credential files.Add
renameWithRetry()utility matching the strategy used by VS Code (pfs.ts) andgraceful-fs: 60s wall-clock timeout with linear backoff (10ms increments, capped at 100ms). Only applies on Windows; other platforms call rename directly.Closes #840