From 4dfa44ecd95a9e6c72188484c2a2871298800e8a Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Tue, 15 Sep 2026 20:34:52 -0400 Subject: [PATCH] bash: use passed exit status in precmd The Bash 4.4+ prompt hook saves the command status before doing its own work and passes it to __ghostty_precmd. The function ignored that argument and instead read the hook invocation status, causing command end markers to report zero. Use the explicit argument when present while retaining the current status fallback required by the older bash-preexec path. See #14247 --- src/shell-integration/bash/ghostty.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell-integration/bash/ghostty.bash b/src/shell-integration/bash/ghostty.bash index 729951ab9..48115da14 100644 --- a/src/shell-integration/bash/ghostty.bash +++ b/src/shell-integration/bash/ghostty.bash @@ -134,7 +134,7 @@ _ghostty_executing="" _ghostty_last_reported_cwd="" function __ghostty_precmd() { - local ret="$?" + local ret="${1:-$?}" if test "$_ghostty_executing" != "0"; then _GHOSTTY_SAVE_PS1="$PS1" _GHOSTTY_SAVE_PS2="$PS2"