Skip to content

Make Windows CI fail when command fails to launch#307

Open
snprajwal wants to merge 1 commit into
swiftlang:mainfrom
snprajwal:fix-launch-failure
Open

Make Windows CI fail when command fails to launch#307
snprajwal wants to merge 1 commit into
swiftlang:mainfrom
snprajwal:fix-launch-failure

Conversation

@snprajwal

Copy link
Copy Markdown
Contributor

Invoke-Program used exit $LastExitCode, but when a native command fails to launch (e.g. a broken toolchain) no exit code is set, leaving $LASTEXITCODE as $null. exit $null exits 0, so the container reports success and the step is green despite the failure (like this occurence in swiftlang/swift-package-manager).

Reset $LASTEXITCODE before each call and fall back to $? when no exit code is produced, so launch failures now fail properly.

Invoke-Program used `exit $LastExitCode`, but when a native command
fails to launch (e.g. a broken toolchain) no exit code is set, leaving
`$LASTEXITCODE` as $null. `exit $null` exits 0, so the container reports
success and the step is green despite the failure (like this
occurence[1] in swiftlang/swift-package-manager).

Reset `$LASTEXITCODE` before each call and fall back to $? when no exit code
is produced, so launch failures now fail properly.

[1]: https://github.com/swiftlang/swift-package-manager/actions/runs/29766644951/job/88434456907?pr=10308
@snprajwal
snprajwal requested a review from a team as a code owner July 22, 2026 12:18
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