mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Closes #11597 ## Problem On Windows, `pi update` stopped with `git clean -fdx failed with code 1` for git extensions such as pi-lens. 1. Another pi session has the extension loaded, so a native module (`@ast-grep/napi` `.node`) or `ast-grep.exe` is open in that process. 2. npm renames the in-use package dir to `node_modules/@ast-grep/.napi-win32-x64-msvc-<hash>`. Windows allows the rename, but npm cannot delete the dir afterwards. 3. The next `pi update` runs `git reset --hard`, then `git clean -fdx`. git prints `warning: failed to remove ...: Invalid argument` and exits 1. 4. pi threw, leaving the checkout at the new commit with the old dependencies. The suggested `-ffdx` does not help. Reproduced locally (git 2.52, Windows): with a running `.exe`, or a `.node` loaded by another node process and its dir renamed, both `-fdx` and `-ffdx` fail with `Invalid argument`. Once the process exits, `-fdx` succeeds. ## Fix In `cleanAndInstallGitDependencies`, a failed `git clean` no longer aborts the update. pi: - prints a warning that files may be in use by another pi session - still runs `npm install`, so dependencies match the new commit - keeps the `.pi-update-incomplete` marker, so the next update retries the clean ## Tests - `test/git-update.test.ts`: new regression test. A failing clean still updates and installs dependencies, warns, and keeps the marker. The next update cleans and removes the marker. - `test/package-manager.test.ts`: updated the test that expected the throw. `npm run check` reports `install-lock is out of date`, and `package-manager.test.ts > should expand ~ in exclusion and exact patterns` fails on Windows. Both also happen on `main` without this change. |
||
|---|---|---|
| .. | ||
| bun | ||
| cli | ||
| core | ||
| experimental | ||
| extensions | ||
| modes | ||
| utils | ||
| cli.ts | ||
| config.ts | ||
| index.ts | ||
| main.ts | ||
| migrations.ts | ||
| package-manager-cli.ts | ||
| rpc-entry.ts | ||