Fixes #4734: Add locking mechanism to prevent race condition in esbuild.mjs #4763
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the race condition in CI that was causing ENOTEMPTY errors when multiple processes attempt to clean and write to the same
src/distdirectory concurrently.Problem
The
pnpm testcommand executed by theplatform-unit-testjob usesturboto run tasks for multiple packages in parallel. The build scriptsrc/esbuild.mjswas being executed concurrently by different packages (e.g.,roo-clineand@roo-code/types), causing race conditions when one process attempts to delete thesrc/distdirectory while another process has already started writing new build artifacts back into it.Solution
Implemented a file-based locking mechanism in
src/esbuild.mjsthat:.esbuild.lock) to ensure only one instance of the script runs at a timeTesting
Changes
src/esbuild.mjsFixes #4734
Important
Introduces a file-based locking mechanism in
src/esbuild.mjsto prevent race conditions during concurrent execution.src/esbuild.mjsto prevent concurrent execution using.esbuild.lock.acquireLock()andreleaseLock()functions manage lock acquisition and release.This description was created by
for 271cc13. You can customize this summary. It will automatically update as commits are pushed.