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

Commit 640b0e3

Browse files
Restore lastexitcode before exit
Resolves #273
1 parent e9ba0c7 commit 640b0e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

oh-my-posh.psm1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function Set-Prompt {
1212
Import-Module $sl.CurrentThemeLocation -Force
1313

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

@@ -39,6 +40,8 @@ function Set-Prompt {
3940
}
4041

4142
$prompt
43+
$global:LASTEXITCODE = $realLASTEXITCODE
44+
Remove-Variable realLASTEXITCODE
4245
}
4346

4447
Set-Item -Path Function:prompt -Value $Prompt -Force

0 commit comments

Comments
 (0)