PowerShell: keep $LASTEXITCODE across the prompt hook (#1342)

Co-authored-by: Ajeet D'Souza <98ajeet@gmail.com>
This commit is contained in:
Marshall Porter
2026-10-24 06:57:58 +05:30
committed by GitHub
co-authored by Ajeet D'Souza
parent 816227d035
commit f0b31631d2
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nushell: `z` now handles relative paths through symlinked directories.
- POSIX: fix `z` failing to enter directories whose names start with `-`.
- Build: fix compilation failing when the source directory is read-only.
- PowerShell: the prompt hook no longer resets `$LASTEXITCODE`.
## [0.10.0] - 2026-07-04
+2
View File
@@ -93,7 +93,9 @@ if ($global:__zoxide_hooked -ne 1) {
if ($null -ne $__zoxide_prompt_old) {
& $__zoxide_prompt_old
}
$exitCode = Microsoft.PowerShell.Utility\Get-Variable LASTEXITCODE -Scope Global -ErrorAction Ignore -ValueOnly
$null = __zoxide_hook
$global:LASTEXITCODE = $exitCode
}
}
{%- endif %}