Skip to content

fix: Move existing file out of the way during rename #1794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FlippingBinary
Copy link

This pull request illustrates one way of potentially ensuring Windows computers can replace the binary even while it is in use. Unfortunately, I'm not experienced with NeoVim plugin development, and I'm not exactly sure how I would simulate the condition that triggers the bug. I tried setting lazy.nvim to get the plugin from a local directory for development, but I'm getting the error about being unable to download the binary without any changes to the code. Since I haven't been able to get the main branch to work correctly when sourcing blink.cmp locally, I'm a bit stuck on how to test this.

@Saghen, would you mind putting eyes on this anyway? The technique of renaming the existing file (if there is one), then deleting it after old_path is renamed to new_path should resolve #1493, but it might introduce the possibility that it could fail to delete the file, causing old binaries to accumulate over time. Maybe that should result in a warning, or a lifecycle trigger could attempt to delete stray files silently. That's why I have it renaming files to contain a .trash- prefix. It makes them easy to identify. My understanding is that recent versions of Windows are POSIX compliant with their unlink implementations, so the files shouldn't accumulate, but there could be an edge case there.

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.

EPERM: operation not permitted [Windows]
1 participant