Check LASTEXITCODE is set before checking its value

pull/13539/head
Matthew Bradbury 4 months ago
parent d644bf9744
commit f9abca0bd7

@ -55,7 +55,7 @@ const wrapPowershellString string = `
$exitCode = 1
}
if ($LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {
if ((Test-Path variable:global:LASTEXITCODE) -and $LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0) {
$exitCode = $LASTEXITCODE
}
exit $exitCode

Loading…
Cancel
Save