Make bash integration tests more robust on macOS

This commit is contained in:
Kovid Goyal
2024-01-24 23:07:38 +05:30
parent 1293ee60e0
commit fa11858a72
4 changed files with 10 additions and 4 deletions

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" {
if runtime.GOOS == "darwin" && 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])
@@ -184,6 +184,9 @@ func RunShell(shell_cmd []string, shell_integration_env_var_val, cwd string) (er
return unix.Exec(utils.FindExe(exe), shell_cmd, env)
}
var debugprintln = tty.DebugPrintln
var _ = debugprintln
func RunCommandRestoringTerminalToSaneStateAfter(cmd []string) {
exe := utils.FindExe(cmd[0])
c := exec.Command(exe, cmd[1:]...)