Commit 62b85d5
committed
Fix Windows CI passing when a command fails to launch
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=103081 parent 497d9ab commit 62b85d5
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
920 | 920 | | |
921 | 921 | | |
922 | 922 | | |
| 923 | + | |
923 | 924 | | |
| 925 | + | |
924 | 926 | | |
925 | | - | |
926 | | - | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
927 | 934 | | |
928 | 935 | | |
929 | 936 | | |
| |||
0 commit comments