diff options
author | Chris Denton <chris@chrisdenton.dev> | 2023-05-03 16:06:16 +0100 |
---|---|---|
committer | Chris Denton <chris@chrisdenton.dev> | 2023-05-03 18:21:36 +0100 |
commit | 9ea7142a013eeb857a8922caf2ec485a056e987f (patch) | |
tree | 936e2a2badc2c23eeaee8772ac30d91ec1523a6f /x.ps1 | |
parent | 82cd953c7c43e64dae6f705ce2f07b291f0e22e3 (diff) | |
download | rust-9ea7142a013eeb857a8922caf2ec485a056e987f.tar.gz |
Return error code from x.ps1
Diffstat (limited to 'x.ps1')
-rwxr-xr-x | x.ps1 | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 } |