Skip to content

fix(install): keep gh probes from aborting on Windows PowerShell 5.1 - #171

Merged
dantraynor merged 1 commit into
mainfrom
fix/install-ps1-gh-probe
Nov 13, 2026
Merged

dantraynor merged 1 commit into
mainfrom
fix/install-ps1-gh-probe

Conversation

@dantraynor

Copy link
Copy Markdown
Owner

What

Run the three gh probes in Test-AvailableAttestation through a small Invoke-GhProbe helper with a local $ErrorActionPreference = 'Continue', and rely on $LASTEXITCODE as before.

Why

Under Windows PowerShell 5.1 with $ErrorActionPreference = 'Stop', redirected native stderr becomes a terminating NativeCommandError. When gh was installed but not logged in, gh auth status aborted the install before the intended "not authenticated" warning. PowerShell 7 was unaffected.

Fixes #151

How to Test

  • scripts/install.test.ps1 under pwsh and stock Windows PowerShell 5.1 (CI host-windows-tests). New test puts a fake gh on PATH that writes to stderr and exits 1 for auth status, and expects the warning instead of a throw.

With ErrorActionPreference=Stop, Windows PowerShell 5.1 turns redirected
native stderr into a terminating NativeCommandError. A gh that is
installed but not logged in therefore aborted the install before the
exit-code check could print the intended warning. Run the gh probes with
a local Continue preference and rely on the exit code.

Fixes #151
@dantraynor
dantraynor force-pushed the fix/install-ps1-gh-probe branch from ffd5c67 to 7998ee9 Compare November 13, 2026 07:17
@dantraynor
dantraynor merged commit a010de2 into main Nov 13, 2026
19 checks passed
@dantraynor
dantraynor deleted the fix/install-ps1-gh-probe branch November 13, 2026 07:22
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.

install.ps1 aborts on Windows PowerShell 5.1 when gh is installed but not logged in

1 participant