From 07b9b82f9f94f884bca8112c25882bf8620bfe00 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 12 Jul 2021 07:35:08 +0200 Subject: [PATCH] fix(pwsh): set lastCommandSuccess first resolves #849 --- src/init/omp.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/init/omp.ps1 b/src/init/omp.ps1 index efd912cc..a3d7603f 100644 --- a/src/init/omp.ps1 +++ b/src/init/omp.ps1 @@ -67,6 +67,10 @@ function global:Initialize-ModuleSupport { } [ScriptBlock]$Prompt = { + #store if the last command was successful + $lastCommandSuccess = $? + #store the last exit code for restore + $realLASTEXITCODE = $global:LASTEXITCODE $omp = "::OMP::" $config, $cleanPWD, $cleanPSWD = Get-PoshContext if ($global:PoshSettings.Transient -eq $true) { @@ -75,10 +79,6 @@ function global:Initialize-ModuleSupport { $global:PoshSettings.Transient = $false return } - #store if the last command was successful - $lastCommandSuccess = $? - #store the last exit code for restore - $realLASTEXITCODE = $global:LASTEXITCODE $errorCode = 0 Initialize-ModuleSupport Set-PoshContext