Skip to content

fix: retry rename on Windows EPERM/EACCES/EBUSY during SSH config save#841

Merged
EhabY merged 3 commits intomainfrom
fix/windows-eperm-rename-retry
Mar 16, 2026
Merged

fix: retry rename on Windows EPERM/EACCES/EBUSY during SSH config save#841
EhabY merged 3 commits intomainfrom
fix/windows-eperm-rename-retry

Conversation

@EhabY
Copy link
Collaborator

@EhabY EhabY commented Mar 16, 2026

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.

Closes #840

@EhabY EhabY self-assigned this Mar 16, 2026
@EhabY EhabY requested a review from johnstcn March 16, 2026 10:34
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but might be no harm to get a second pair of eyes.

EhabY added 3 commits March 16, 2026 17:50
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.
@EhabY EhabY force-pushed the fix/windows-eperm-rename-retry branch from 2cb3dce to b40db7d Compare March 16, 2026 14:51
@EhabY EhabY merged commit 11911fc into main Mar 16, 2026
9 of 12 checks passed
@EhabY EhabY deleted the fix/windows-eperm-rename-retry branch March 16, 2026 15:19
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.

Windows: EPERM when renaming temporary SSH config file

2 participants