diff options
| author | bors <bors@rust-lang.org> | 2023-05-03 23:17:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-03 23:17:21 +0000 |
| commit | f557a4fd462a779c92e4e8bd004426cf329efb30 (patch) | |
| tree | 863a4f47f25435437fd93c618b56dae3dff5cfe8 | |
| parent | 473f916d836cc662c5bdbb0d40af9fb4678fab9e (diff) | |
| parent | 9ea7142a013eeb857a8922caf2ec485a056e987f (diff) | |
Auto merge of #111141 - ChrisDenton:ps-exitcode, r=jyn514
Return error code from x.ps1 Fixes #111136 This works around a bug where `ExitCode` does not return the exit code. See: https://stackoverflow.com/a/23797762
| -rwxr-xr-x | x.ps1 | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/x.ps1 b/x.ps1 index f324a4676c8..b0cddc9f930 100755 --- a/x.ps1 +++ b/x.ps1 @@ -16,7 +16,14 @@ function Get-Application($app) { function Invoke-Application($application, $arguments) { $process = Start-Process -NoNewWindow -PassThru $application $arguments + # WORKAROUND: Caching the handle is necessary to make ExitCode work. + # See https://stackoverflow.com/a/23797762 + $handle = $process.Handle $process.WaitForExit() + if ($null -eq $process.ExitCode) { + Write-Error "Unable to read the exit code" + Exit 1 + } Exit $process.ExitCode } |
