Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Restore lastexitcode before exit
Browse files Browse the repository at this point in the history
Resolves #273
  • Loading branch information
JanDeDobbeleer committed Aug 11, 2020
1 parent e9ba0c7 commit 640b0e3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions oh-my-posh.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function Set-Prompt {
Import-Module $sl.CurrentThemeLocation -Force

[ScriptBlock]$Prompt = {
$realLASTEXITCODE = $global:LASTEXITCODE
$lastCommandFailed = ($global:error.Count -gt $sl.ErrorCount) -or -not $?
$sl.ErrorCount = $global:error.Count

Expand Down Expand Up @@ -39,6 +40,8 @@ function Set-Prompt {
}

$prompt
$global:LASTEXITCODE = $realLASTEXITCODE
Remove-Variable realLASTEXITCODE
}

Set-Item -Path Function:prompt -Value $Prompt -Force
Expand Down

0 comments on commit 640b0e3

Please sign in to comment.