refactor(pwsh): check history id instead of command line

This commit is contained in:
L. Yeung 2022-05-16 23:26:25 +08:00 committed by Jan De Dobbeleer
parent 48746495d4
commit e041c23fe1

View file

@ -263,7 +263,7 @@ Example:
$global:Error[0] | Where-Object { $_ -ne $null } | Select-Object -ExpandProperty InvocationInfo $global:Error[0] | Where-Object { $_ -ne $null } | Select-Object -ExpandProperty InvocationInfo
} catch { $null } } catch { $null }
# check if the last command caused the last error # check if the last command caused the last error
if ($null -ne $invocationInfo -and $lastHistory.CommandLine -eq $invocationInfo.Line) { if ($null -ne $invocationInfo -and $script:LastHistoryId -eq $invocationInfo.HistoryId) {
$script:ErrorCode = 1 $script:ErrorCode = 1
} elseif ($realLASTEXITCODE -is [int] -and $realLASTEXITCODE -ne 0) { } elseif ($realLASTEXITCODE -is [int] -and $realLASTEXITCODE -ne 0) {
# native app exit code # native app exit code