Skip to content

emrg: installer shows stop-emrg.cmd output on failure - #727

Merged
argszero merged 1 commit into
masterfrom
feature/installer-show-stop-log
Aug 13, 2026
Merged

emrg: installer shows stop-emrg.cmd output on failure#727
argszero merged 1 commit into
masterfrom
feature/installer-show-stop-log

Conversation

@argszero

Copy link
Copy Markdown
Owner

Implements host rant 2026-08-13T09:24:37.

Problem: v0.2.29 installer aborts with bare "stop-emrg.cmd exit code 1" — the host must manually run stop-emrg.cmd to see which process could not be killed.

Fix (in packaging/make-installer.sh PrepareToInstall):

  1. Redirect stop-emrg.cmd stdout+stderr to {tmp}\\stop-emrg.log (/c ""script" > "log" 2>&1" — quote nesting: outer cmd /c wraps, inner script path quoted, redirect outside).
  2. On non-zero exit, load the log via LoadStringFromFile (truncated to first 2000 chars) and include it in the abort message: "Details from stop-emrg.cmd: ... still running: vim.exe (pid 868) ...".
  3. Exit-code semantics unchanged (non-zero still aborts); fallback to the original generic message when the log is empty/unreadable.

Verification: tests/test_installer_stop.py updated (log redirection + LoadStringFromFile + 2000-char truncation + Details marker asserted); full pytest 758 green; import + CLI checks pass. Doc counts unchanged (no test-count change).

@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. CI run 31658239201 SUCCESS (test + test-windows both green). Verified: PrepareToInstall redirects stop-emrg.cmd output to {tmp}\stop-emrg.log (2>&1), on non-zero exit loads the log via LoadStringFromFile with 2000-char truncation and surfaces "Details from stop-emrg.cmd: ..." in the abort message; exit-code semantics preserved (non-zero still aborts); fallback to generic message when log empty. Full pytest 758 green locally.

@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 (2/3)

Reviewed the full diff on feature/installer-show-stop-log (e9f810d):

  • Quote nesting verified: /c ""script" > "log" 2>&1" — cmd's /c rule-2 processing strips the leading quote and trailing quote, yielding "script" > "log" 2>&1; redirection is inside the command (captured under SW_HIDE), matching the standard quoted-path-with-redirect idiom.
  • Failure path: on non-zero exit the log is loaded via LoadStringFromFile (2000-char truncation guard) and surfaced as "Details from stop-emrg.cmd: ..." — the host no longer needs to run the helper manually to see which process held a lock.
  • Fallbacks: empty/unreadable log falls back to the original generic message; the Exec-failure branch is untouched; non-zero exit still aborts (semantics preserved).
  • Tests: tests/test_installer_stop.py asserts the new quoting pattern, LoadStringFromFile, the 2000-char truncation, and the Details marker — 5/5 passed locally on this branch; CI run 31658239201 (test + test-windows) green; mergeable.

No issues found.

@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 (3/3)

Third independent cycle confirming: the change is minimal and correct — PrepareToInstall redirects stop-emrg.cmd output to {tmp}\stop-emrg.log (2>&1) and surfaces its content on failure, exactly per rant 2026-08-13T09:24:37. CI (31658239201 test + test-windows) green; pytest 758 green locally. Merge.

@argszero
argszero merged commit 9599852 into master Aug 13, 2026
2 checks passed
argszero added a commit that referenced this pull request Aug 13, 2026
…lease windows gate)

v0.2.30 Build Release 31661378619 failed at the windows 'Make installer'
step: iscc rejected the emrg.iss [Code] section with
'Invalid number of parameters' on LoadStringFromFile(LogFile).

Root cause: Inno Setup's Pascal Script API declares
  function LoadStringFromFile(const FileName: String; var S: AnsiString): Boolean;
(2-param out-argument form, identical in 6.7.1 through 7.x — verified
against issrc Shared.ScriptFunc.pas). #727's R125 log-surfacing code
called the non-existent 1-param string-returning form; the Test workflow
never compiles the .iss, so the error only surfaced at tag-push Build
Release (v0.2.7 lesson recurring).

Fix (folded into #731's iscc gate):
- make-installer.sh: call LoadStringFromFile(LogFile, LogText) (out-param),
  keep FileExists guard + 2000-char truncation
- tests/test_installer_stop.py: assert the 2-param form (positive) and
  forbid the 1-param form (negative)
argszero added a commit that referenced this pull request Aug 13, 2026
* emrg: add iscc compile gate to Windows test job (v0.2.30 .iss failure class)

* emrg: fix .iss LoadStringFromFile 2-param signature (v0.2.30 Build Release windows gate)

v0.2.30 Build Release 31661378619 failed at the windows 'Make installer'
step: iscc rejected the emrg.iss [Code] section with
'Invalid number of parameters' on LoadStringFromFile(LogFile).

Root cause: Inno Setup's Pascal Script API declares
  function LoadStringFromFile(const FileName: String; var S: AnsiString): Boolean;
(2-param out-argument form, identical in 6.7.1 through 7.x — verified
against issrc Shared.ScriptFunc.pas). #727's R125 log-surfacing code
called the non-existent 1-param string-returning form; the Test workflow
never compiles the .iss, so the error only surfaced at tag-push Build
Release (v0.2.7 lesson recurring).

Fix (folded into #731's iscc gate):
- make-installer.sh: call LoadStringFromFile(LogFile, LogText) (out-param),
  keep FileExists guard + 2000-char truncation
- tests/test_installer_stop.py: assert the 2-param form (positive) and
  forbid the 1-param form (negative)

* emrg: de-backtick heredoc comment + shellcheck-clean iscc gate

- make-installer.sh: the LoadStringFromFile signature comment used backticks
  inside the unquoted <<EOF heredoc — backticks trigger command substitution,
  breaking .iss rendering in the real build too (iscc gate caught it)
- test.yml: split assignment from export to silence shellcheck
  SC2318/SC2097/SC2098 in the gate step

* emrg: stub icon.ico + {app} files in iscc compile gate (gen-assets artifacts)

* emrg: SC2016-clean sed anchor + heredoc comment reword

- test.yml: sed extraction pattern used \$STAGE inside single quotes
  (shellcheck SC2016); switch to a dollar-free anchored pattern
- make-installer.sh: reword heredoc comment to avoid literal command
  substitution syntax

* emrg: LogText must be AnsiString for LoadStringFromFile var param (iscc Type mismatch)

---------

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero pushed a commit that referenced this pull request Aug 13, 2026
…entries (#744)

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
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