diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index 4511225b..68daa0f5 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -280,7 +280,7 @@ Example: $global:Error[0] | Where-Object { $_ -ne $null } | Select-Object -ExpandProperty InvocationInfo } catch { $null } # check if the last command caused the last error - if ($null -ne $invocationInfo -and $script:LastHistoryId -eq $invocationInfo.HistoryId) { + if ($null -ne $invocationInfo -and $lastHistory.CommandLine -eq $invocationInfo.Line) { $script:ErrorCode = 1 } elseif ($realLASTEXITCODE -is [int] -and $realLASTEXITCODE -ne 0) { # native app exit code