Skip to content

Commit 9d8087f

Browse files
committed
fix(cli): preserve bridge exit codes (#6965)
1 parent 8dd4cd4 commit 9d8087f

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/main/cli/wsl-cli-installer.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ describe('WslCliInstaller', () => {
239239
expect(bridge).toContain('$env:ORCA_CLI_CWD = $WslCwd')
240240
expect(bridge).toContain('Push-Location -LiteralPath (Split-Path -Parent $OrcaLauncher)')
241241
expect(bridge).toContain('& $OrcaLauncher @ForwardArgs')
242+
expect(bridge).toContain('if ($null -eq $LASTEXITCODE)')
243+
expect(bridge).toContain('$exitCode = $LASTEXITCODE')
242244
expect(bridge).toContain('Pop-Location')
243245
expect(bridge).toContain('if ($previousCliCwdExists) {')
244246
expect(bridge).toContain('Remove-Item Env:ORCA_CLI_CWD -ErrorAction SilentlyContinue')

src/main/cli/wsl-cli-scripts.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ try {
5151
Push-Location -LiteralPath (Split-Path -Parent $OrcaLauncher)
5252
try {
5353
& $OrcaLauncher @ForwardArgs
54-
if (-not $?) {
55-
$exitCode = 1
56-
} elseif ($null -eq $LASTEXITCODE) {
57-
$exitCode = 0
54+
if ($null -eq $LASTEXITCODE) {
55+
if (-not $?) {
56+
$exitCode = 1
57+
} else {
58+
$exitCode = 0
59+
}
5860
} else {
5961
$exitCode = $LASTEXITCODE
6062
}

0 commit comments

Comments
 (0)