Skip to content
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

Try to fix EPERM #185

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

Try to fix EPERM #185

wants to merge 3 commits into from

Conversation

mifi
Copy link

@mifi mifi commented Apr 17, 2020

See #104

@@ -99,7 +99,7 @@ function patch (fs) {
&& Date.now() - start < 60000) {
setTimeout(function() {
fs.stat(to, function (stater, st) {
if (stater && stater.code === "ENOENT")
if ((stater && stater.code === "ENOENT") || (st && st.isFile()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you explain this fix, maybe add a comment? Is the situation that to already exists but is maybe open by another process so windows gives EACCES or EPERM when trying to overwrite the destination?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, as explained in this #104 (comment) , after the stat check was added, he started seeing these errors. to already exists because it is a config file that is being atomically renamed to (overwritten). The stat check was added because the retry mechanism was causing a long retry delay in the case that to is a directory because it would give the same error and thereby retry until timeout. Therefore with st.isFile() it should still give up on directories.

@bpasero
Copy link

bpasero commented Jul 26, 2023

I think this change should go in 👍

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.

None yet

3 participants