Fix regression causing shells in darwin to not run in login mode

This commit is contained in:
Kovid Goyal 2024-02-11 15:29:32 +05:30
parent 0a1eb038a5
commit b65a5f78fd
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 1 deletions

View file

@ -90,6 +90,7 @@ def run_shell(self, shell='zsh', rc='', cmd='', setup_env=None):
cmd = cmd or shell
cmd = shlex.split(cmd.format(**locals()))
env = (setup_env or safe_env_for_running_shell)(cmd, home_dir, rc=rc, shell=shell, with_kitten=self.with_kitten)
env['KITTY_RUNNING_SHELL_INTEGRATION_TEST'] = '1'
try:
if self.with_kitten:
cmd = [kitten_exe(), 'run-shell', '--shell', shlex.join(cmd)]

View file

@ -163,7 +163,7 @@ func RunShell(shell_cmd []string, shell_integration_env_var_val, cwd string) (er
shell_env = env
}
exe := shell_cmd[0]
if runtime.GOOS == "darwin" && os.Getenv("KITTY_RUNNING_BASH_INTEGRATION_TEST") != "" {
if runtime.GOOS == "darwin" && (os.Getenv("KITTY_RUNNING_SHELL_INTEGRATION_TEST") != "1" || os.Getenv("KITTY_RUNNING_BASH_INTEGRATION_TEST") != "") {
// ensure shell runs in login mode. On macOS lots of people use ~/.bash_profile instead of ~/.bashrc
// which means they expect the shell to run in login mode always. Le Sigh.
shell_cmd[0] = "-" + filepath.Base(shell_cmd[0])