Conversation
| setTimeout(function() { | ||
| fs.stat(to, function (stater, st) { | ||
| if (stater && stater.code === "ENOENT") | ||
| if ((stater && stater.code === "ENOENT") || (st && st.isFile())) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
I think this change should go in 👍 |
|
Would be nice to see this merged and released |
See #104