diff options
| author | Jon Parise <jon@indelible.org> | 2025-07-10 15:12:54 -0400 |
|---|---|---|
| committer | Jon Parise <jon@indelible.org> | 2025-07-10 15:47:55 -0400 |
| commit | 01233a48d14cb9ae191c085a386bccfbafb91243 (patch) | |
| tree | 57e7e3dd30f252782154bfc12251e73bd42d3187 /src/shell-integration | |
| parent | cc646ecf46268686a2d7268ef20826a26f2952f9 (diff) | |
bash: preserve an existing ENV value
Our bash shell integration code uses ENV (in POSIX mode) to bootstrap
our shell integration script. This had the side effect of overwriting an
existing ENV value.
This change preserves ENV by storing it temporarily in GHOSTTY_BASH_ENV.
Note that this doesn't enable --posix mode support for automatic shell
integration. (--posix does work; we just skip shell integration when
that flag is specified.) We can reconsider implementing full --posix
support separately.
Diffstat (limited to 'src/shell-integration')
| -rw-r--r-- | src/shell-integration/bash/ghostty.bash | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shell-integration/bash/ghostty.bash b/src/shell-integration/bash/ghostty.bash index aacf37c3a..ca5a012c6 100644 --- a/src/shell-integration/bash/ghostty.bash +++ b/src/shell-integration/bash/ghostty.bash @@ -26,6 +26,12 @@ if [ -n "$GHOSTTY_BASH_INJECT" ]; then builtin declare __ghostty_bash_flags="$GHOSTTY_BASH_INJECT" builtin unset ENV GHOSTTY_BASH_INJECT + # Restore an existing ENV that was replaced by the shell integration code. + if [[ -n "$GHOSTTY_BASH_ENV" ]]; then + builtin export ENV=$GHOSTTY_BASH_ENV + builtin unset GHOSTTY_BASH_ENV + fi + # Restore bash's default 'posix' behavior. Also reset 'inherit_errexit', # which doesn't happen as part of the 'posix' reset. builtin set +o posix |
