fix(install): avoid truncating lock file to prevent sharing violation on Windows#1467
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
|
@codex review |
|
@rorychatt Could you add a corresponding test? Unit tests or snap tests are both fine. |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@fengmk2 sure. I will get back to you in the evening. |
7925c93 to
31b8a9d
Compare
|
To get absolute proof, I wrote a dedicated cross-process test script locally that spawns a child process to exclusively lock the file, while the parent process attempts to open it simultaneously When the parent process used the old File::create logic, it crashed with ERROR_SHARING_VIOLATION, perfectly reproducing the bug. When I switched the parent process to use our extracted OpenOptions fix, it cleanly opened the handle and waited in line for the lock without any errors, proving the fix works flawlessly Because standard cargo test runs in a single process, the unit test I added serves to verify the syntactic correctness of the extracted open_lock_file function and ensures it successfully acquires and releases the lock |
|
@fengmk2 Sorry, I removed the unused import. Linting should pass now |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #1465