fix(installer): stop PS 5.1 stderr wrapping from aborting version probes - #1255
Open
MasterFede5 wants to merge 1 commit into
Open
fix(installer): stop PS 5.1 stderr wrapping from aborting version probes#1255MasterFede5 wants to merge 1 commit into
MasterFede5 wants to merge 1 commit into
Conversation
install.ps1 sets $ErrorActionPreference = "Stop" globally, but Windows PowerShell 5.1 (the default powershell.exe the README instructs users to run) wraps redirected native stderr lines in ErrorRecords. The two '--version 2>&1' probes therefore treat any healthy binary that prints a warning to stderr (exit code 0) as a fatal error and abort the install. Relax EAP to Continue only around the two native probe calls, restoring it in a finally block; failure detection remains on $LASTEXITCODE. Reproduced on PS 5.1.26100.8875 with a stub that prints a version to stdout, one warning line to stderr, and exits 0: the previous pattern aborts, the new pattern captures the version and still detects nonzero exits. tests/test_windows_bundle_contract.sh passes (the literal '& $DownloadedLauncher --version' invariant is preserved). Signed-off-by: MasterFede5 <friedrickms@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: MasterFede5 <friedrickms@gmail.com>
Owner
|
Thanks for this, and sorry for the delayed acknowledgement. Queued for review. A +19/-2 single-file change is easy to review — nothing blocking from a size standpoint. CI shows 1-2 failing checks worth checking while it waits. PowerShell 5.1 wrapping stderr and thereby aborting verification is a nasty class of bug: it makes a working install look broken for reasons that have nothing to do with the install. Good catch. |
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.
What does this PR do?
Fixes a Windows PowerShell 5.1 failure mode in
install.ps1: the script sets$ErrorActionPreference = "Stop"globally, and PS 5.1 (the defaultpowershell.exethe README instructs users to run) wraps redirected native stderr in ErrorRecords. The two--version 2>&1probes (candidate at ~L265, installed binary at ~L288) therefore abort the whole install for any healthy binary that prints a single warning line to stderr while exiting 0 — reportingerror: downloaded binary failed to run.The fix relaxes EAP to
Continueonly around the two native probe calls, restoring it in afinallyblock. Failure detection is unchanged: it stays on$LASTEXITCODE.Reproduction (PS 5.1.26100.8875,
powershell.exe -File): stub binary printing a version to stdout + one warning to stderr, exit 0 → previous pattern aborts with the stderr text as the exception; new pattern captures the version output and still detects a nonzero exit (tested with exit 3). EAP is restored toStopafterwards.The literal invariants checked by
tests/test_windows_bundle_contract.sh(& $DownloadedLauncher --version, launcher-only invocation) are preserved — that contract test passes locally.Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
make -f Makefile.cbm test) — not run: no C toolchain on this machine; the change touches onlyinstall.ps1.tests/test_windows_bundle_contract.sh(the suite that asserts installer invariants) passes locally.make -f Makefile.cbm lint-ci) — C linters not applicable to this script-only change;install.ps1parses clean (PSParser, 0 errors).🤖 Generated with Claude Code