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
This commit is contained in:
Jon Parise
2026-09-15 20:34:52 -04:00
parent d4c88d8069
commit 4dfa44ecd9

View File

@@ -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"