Skip to content

Commit

Permalink
fix(scan): handle race condition for tempDir removal (#2299)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Mar 2, 2021
1 parent ee86d2c commit 67e56e4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/vite/src/node/optimizer/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ export async function scanImports(
)
)

emptyDir(tempDir)
fs.rmdirSync(tempDir)
try {
emptyDir(tempDir)
fs.rmdirSync(tempDir)
} catch (err) {
if (err.code !== 'ENOENT') {
throw err
}
}

debug(`Scan completed in ${Date.now() - s}ms:`, deps)

Expand Down

0 comments on commit 67e56e4

Please sign in to comment.