bash: narrow the scope of GHOSTTY_BASH_ENV (#4690)

GHOSTTY_BASH_ENV is only set in the '--posix' path. This change is a
code organization improvement and doesn't change the script's behavior.
This commit is contained in:
Mitchell Hashimoto
2025-01-06 16:01:41 -08:00
committed by GitHub

View File

@ -24,6 +24,7 @@ if [ -n "$GHOSTTY_BASH_INJECT" ]; then
builtin source "$GHOSTTY_BASH_ENV" builtin source "$GHOSTTY_BASH_ENV"
builtin export ENV="$GHOSTTY_BASH_ENV" builtin export ENV="$GHOSTTY_BASH_ENV"
fi fi
builtin unset GHOSTTY_BASH_ENV
else else
# Restore bash's default 'posix' behavior. Also reset 'inherit_errexit', # Restore bash's default 'posix' behavior. Also reset 'inherit_errexit',
# which doesn't happen as part of the 'posix' reset. # which doesn't happen as part of the 'posix' reset.
@ -64,7 +65,7 @@ if [ -n "$GHOSTTY_BASH_INJECT" ]; then
fi fi
fi fi
builtin unset GHOSTTY_BASH_ENV GHOSTTY_BASH_RCFILE builtin unset GHOSTTY_BASH_RCFILE
builtin unset ghostty_bash_inject rcfile builtin unset ghostty_bash_inject rcfile
fi fi