Check LASTEXITCODE is set before checking its value

This commit is contained in:
Matthew Bradbury 2025-11-26 12:04:42 +00:00
parent d644bf9744
commit f9abca0bd7

View file

@ -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