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

fix(scan): handle race condition for tempDir removal #2299

Merged
merged 3 commits into from
Mar 2, 2021

Conversation

pi0
Copy link
Contributor

@pi0 pi0 commented Feb 27, 2021

When calling vite.build rapidly, there is a race condition situation where directory is already removed already by previous build (nuxt-vite issue)

pi0 added a commit to nuxt/vite that referenced this pull request Feb 27, 2021
@nrayburn-tech
Copy link

It is preferred to try and remove the directory and just catch the error. This ensures that nothing happens between the check for existence and the attempt to remove.
It is sync here, so nothing will happen in the JavaScript to change the file, but it is possible something outside of the JavaScript can happen. (Unlikely, but possible.)
https://nodejs.org/api/fs.html#fs_fs_exists_path_callback

@pi0 pi0 changed the title fix(scan): ensure tempDir exists before attempting to remove fix(scan): handle race condition for tempDir removal Feb 27, 2021
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

4 participants