Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,8 @@ function gracefulRename(
) {
setTimeout(function () {
fs.stat(to, function (stater, st) {
if (stater && stater.code === 'ENOENT') gracefulRename(from, to, CB)
else cb(er)
if (stater && stater.code === 'ENOENT') fs.rename(from, to, CB)
Copy link
Member Author

Choose a reason for hiding this comment

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

else CB(er)
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to be a bug on node-graceful-fs. If the code isn't 'ENOENT', it means the directory still exists and we should keep retrying. So we need to call CB. Calling cb ends the recursion returning the original error.

Copy link
Member

Choose a reason for hiding this comment

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

Great catch. This makes sense to me too after catching the flow.

})
}, backoff)
if (backoff < 100) backoff += 10
Expand Down