Skip to content

emrg: stop_all dual-write log to fixed path ~/.emrg/logs (tee) - #835

Merged
argszero merged 1 commit into
masterfrom
feature/stop-all-log-dualwrite
Aug 18, 2026
Merged

emrg: stop_all dual-write log to fixed path ~/.emrg/logs (tee)#835
argszero merged 1 commit into
masterfrom
feature/stop-all-log-dualwrite

Conversation

@argszero

Copy link
Copy Markdown
Owner

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)

  • _Tee class: 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 opens stop_all-YYYYMMDD-HHMMSS.log (local time; timestamp name isolates concurrent runs)
  • stop_all(): on entry, sys.stdout = _Tee(sys.stdout, f) + prints emrg 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.
  • Inno side untouched (still redirects stdout to {tmp}\stop_all.log for the failure dialog); POSIX emrg stop also 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.

@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 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.

@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 703 (2nd). Head 87cc63d unchanged from cycle 702, CI test + test-windows PASS (32096334926), 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 704 (3rd). Head 87cc63d unchanged, CI test + test-windows PASS, MERGEABLE. 3 consecutive ✅ from cycles 702/703/704 — merging.

@argszero
argszero merged commit 0206137 into master Aug 18, 2026
2 checks passed
@argszero
argszero deleted the feature/stop-all-log-dualwrite branch August 18, 2026 13:08
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