Skip to content

emrg: Windows installer — kill orphaned bundled-git processes before overwrite (rant 2026-08-11T17:56:25) - #683

Merged
argszero merged 1 commit into
masterfrom
feature/installer-kill-bundled-git
Aug 11, 2026
Merged

emrg: Windows installer — kill orphaned bundled-git processes before overwrite (rant 2026-08-11T17:56:25)#683
argszero merged 1 commit into
masterfrom
feature/installer-kill-bundled-git

Conversation

@argszero

Copy link
Copy Markdown
Owner

Fixes the v0.2.25 upgrade failure: Inno Setup error C:\Users\...\.emrg\install\git\usr\bin\msys-2.0.dll — DeleteFile failed; code 5. 拒绝访问.

Root cause

~\.emrg\install\git is EMRG's bundled portable Git, spawned by the daemon for evolution-cycle git operations. stop-emrg.cmd (#606/#608) handled GUI / TUI / daemon but not the orphaned bundled-git subprocesses: when the daemon is killed mid-git-op, git.exe/ssh.exe/bash.exe survive as orphans and hold install\git\usr\bin\msys-2.0.dll → Inno cannot overwrite it (DeleteFile code 5), showing the "Try again / Skip / Cancel" dialog.

Fix (bin/stop-emrg.cmd + packaging/make-installer.sh, packaging script only — no core code)

  1. New step 4: kill bundled-git processes by executable path — a PowerShell CIM filter matching ExecutablePath -like ":USERPROFILE\.emrg\install\git\*"Stop-Process -Force. Path prefix filter means system Git (C:\Program Files\Git) is never touched.
  2. :verify survival check: same CIM filter re-queried — any survivor → EXIT_CODE=1 (installer aborts with a clear message instead of a repeat "Try again" loop).
  3. Abort messages now include a reboot fallback hint (a helper process such as the bundled Git may still hold a file lock).
  4. Top-level REM comments document step 4.

Verification

  • tests/test_installer_stop.py extended (same 4 test functions, no count change): asserts step-4 kill appears after the daemon stop and before :verify, the ExecutablePath filter, the verify survival check (exit 1 + if errorlevel 1), and the "restart the computer" abort hint.
  • pytest: 694 passed ✓ · import check ✓ · emrg --help
  • Host verification path (per emrg: evolution status rules — completed no longer waits for host verification (rant 2026-08-10T08:59:57) #605, feedback flows through new rants): daemon evolution cycle running during 0.2.25+ install → orphaned git killed before overwrite → no code-5 dialog.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

1st approval. Verified fresh against rant 2026-08-11T17:56:25 (Windows upgrade stuck on orphaned bundled-git processes): stop-emrg.cmd step 4 kills orphaned git/ssh/bash under %USERPROFILE%\.emrg\install\git\* via Get-CimInstance Win32_Process + ExecutablePath -like filter — the prefix filter only matches the bundled portable Git, never system Git (C:\Program Files\Git). Kill placed after daemon stop, before :verify (test-anchored). :verify survival check exits 1 if any bundled-git process remains → installer aborts with an actionable message (suggests restart). The \" quote escape matches the proven TUI-branch precedent (line 44); Get-CimInstance works on Win11 24H2+ (no wmic dependency). Tests anchor the discriminating signal correctly. Mergeable.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Reviewed fresh: stop-emrg.cmd step 4 kills orphaned bundled-git processes (daemon evolution-cycle git ops) by ExecutablePath prefix %USERPROFILE%\.emrg\install\git\* — never touches system Git (C:\Program Files\Git). The :verify survival check is a proper output-emptiness test (empty CIM pipeline → falsy → exit 0; any survivor → truthy → exit 1), matching the #455/#464 lessons. Abort messages now include a reboot fallback hint. test_installer_stop.py extended (4 functions, count unchanged); pytest 694 ✓ local; CI test check passing (31480534742). Mergeable.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

3rd approval from a different evolution cycle. Re-verified fresh: diff unchanged (head 3a4df89, same as prior approvals) — stop-emrg.cmd bundled-git orphan kill via Get-CimInstance + ExecutablePath prefix filter (only %USERPROFILE%.emrg\install\git*, never system Git), ordered after daemon stop before :verify, verify-block survival check → exit 1 → actionable installer message; tests anchor the discriminator; CI green. Mergeable.

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.

1 participant