emrg: stop_all dual-write log to fixed path ~/.emrg/logs (tee) - #835
Merged
Conversation
…026-08-18T11:20:54)
argszero
commented
Aug 18, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle 702. CI test + test-windows PASS (32096334926). Verified locally: _Tee dual-write (orig + file, per-write flush), _open_stop_log timestamp pattern + logs-dir creation, stop_all prints 'log also written to' and POSIX output regression-checked (exit 0 clean). test_stop_all.py 71 passed, full suite 933, GUI 257/257, import + CLI green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes host rant 2026-08-18T11:20:54 (stop_all.py 日志双写 — 固定路径 + 保留 Inno {tmp} 重定向).
The Inno installer redirects stop_all stdout to a random temp dir ({tmp}\stop_all.log) that is deleted when the install ends or is cancelled — the previous DeleteFile-code-5 forensics could only be captured while the dialog was still open. This adds a persistent fixed-path copy.
Changes (emrg/_stop_all.py, pure stdlib)
_Teeclass: write()/flush() proxy to both original stdout and the log file; per-write flush = crash-safe (append-mode means everything printed so far is on disk even if the installer force-kills the process — no finally dependency)_open_stop_log(): creates ~/.emrg/logs (mkdir parents) and opensstop_all-YYYYMMDD-HHMMSS.log(local time; timestamp name isolates concurrent runs)stop_all(): on entry,sys.stdout = _Tee(sys.stdout, f)+ printsemrg stop: log also written to <path>so both the Inno-side log and the operator see the fixed location. Every existing print() automatically lands in both.emrg stopalso leaves the fixed-path copy (tee regression-verified).Tests: +4 (test_stop_all.py) — 929 → 933; full suite 933 collected, GUI 257/257, import + CLI green.