Skip to content

bash: suppress __ghostty_hook errors in inherited PROMPT_COMMAND - #11690

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
jparise:bash-prompt_command-stderr
Mar 20, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
jparise:bash-prompt_command-stderr

Conversation

@jparise

@jparise jparise commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

When some tools spawn subshells, PROMPT_COMMAND may be inherited as an environment variable while the __ghostty_hook function is not (bash doesn't export functions by default). This causes "command not found" errors on every prompt in the subshell.

Add 2>/dev/null to the __ghostty_hook entry in PROMPT_COMMAND so that it silently no-ops in subshells where the function isn't defined. This also silences any errors from inside __ghostty_hook itself, but those are all terminal escape sequences and non-actionable.

See: #11245

When some tools spawn subshells, PROMPT_COMMAND may be inherited as an
environment variable while the __ghostty_hook function is not (bash
doesn't export functions by default). This causes "command not found"
errors on every prompt in the subshell.

Add 2>/dev/null to the __ghostty_hook entry in PROMPT_COMMAND so that it
silently no-ops in subshells where the function isn't defined. This also
silences any errors from inside __ghostty_hook itself, but those are all
terminal escape sequences and non-actionable.

See: ghostty-org#11245
@jparise jparise added this to the 1.3.2 milestone Mar 20, 2026
@jparise
jparise requested a review from a team as a code owner March 20, 2026 13:42
@mitchellh
mitchellh merged commit e2399de into ghostty-org:main Mar 20, 2026
67 checks passed
@jparise
jparise deleted the bash-prompt_command-stderr branch March 20, 2026 13:52
@mitchellh mitchellh modified the milestones: 1.3.2, 1.4.0 Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants