Propagate te.exe exit code from run-tests.ps1#40497
Merged
benhillis merged 1 commit intoMay 11, 2026
Merged
Conversation
`te.exe` is invoked as a native command, so its failure should be detected via `0` rather than `!True` (which can be unreliable for native processes under `Set-StrictMode`). Also propagate the actual exit code instead of substituting a hardcoded `1` so callers (CI, wrapper scripts) can distinguish between te.exe failure modes. Also fix the `-Package` parameter doc: the actual default is `.\installer.msix`, not `.\wsl.msix`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the PowerShell test runner to correctly detect and propagate te.exe exit codes, and aligns parameter help text with the actual default package path.
Changes:
- Switch failure detection from
$?to$LASTEXITCODEfor the nativete.exeinvocation. - Propagate the real
te.exeexit code instead of exiting with a hardcoded1. - Fix
-Packageparameter docs to match the actual default (.\installer.msix).
Comment on lines
105
to
109
| te.exe $teArgList | ||
| if (!$?) | ||
| if ($LASTEXITCODE -ne 0) | ||
| { | ||
| exit 1 | ||
| exit $LASTEXITCODE | ||
| } |
| Path to test data folder. Defaults to ".\test_data". | ||
| .PARAMETER Package | ||
| Path to the wsl.msix package to install. Defaults to ".\wsl.msix". | ||
| Path to the wsl.msix package to install. Defaults to ".\installer.msix". |
| if ($LASTEXITCODE -ne 0) | ||
| { | ||
| exit 1 | ||
| exit $LASTEXITCODE |
OneBlue
approved these changes
May 11, 2026
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.
Split out from #40489.
te.exeis invoked as a native command inrun-tests.ps1, so its failure should be detected via0rather than!True(which can be unreliable for native processes underSet-StrictMode). The script also substitutes a hardcoded1instead of propagating te.exe's actual exit code, which loses information for CI / wrapper scripts that distinguish between failure modes.The
-Packageparameter doc lists the default as.\wsl.msix, but the actual default in theparam()block is.\installer.msix.Changes (
tools/test/run-tests.ps1)0 -ne 0and propagate0on exit.-Packageparameter doc to match the real default.\installer.msix.