diff --git a/shell.go b/shell.go index fb836f3a..428bb496 100644 --- a/shell.go +++ b/shell.go @@ -15,15 +15,17 @@ const ( // Shell is a type that contains a prompt and the command to set up the shell. type Shell struct { - Command []string - Env []string + Command []string + Env []string + OverwriteEnv []string } // Shells contains a mapping from shell names to their Shell struct. var Shells = map[string]Shell{ bash: { - Env: []string{"PS1=\\[\\e[38;2;90;86;224m\\]> \\[\\e[0m\\]", "BASH_SILENCE_DEPRECATION_WARNING=1"}, - Command: []string{"bash", "--noprofile", "--norc", "--login", "+o", "history"}, + Env: []string{"PS1=\\[\\e[38;2;90;86;224m\\]> \\[\\e[0m\\]", "BASH_SILENCE_DEPRECATION_WARNING=1"}, + Command: []string{"bash", "--noprofile", "--norc", "--login", "+o", "history"}, + OverwriteEnv: []string{"PROMPT_COMMAND="}, }, zsh: { Env: []string{`PROMPT=%F{#5B56E0}> %F{reset_color}`}, diff --git a/tty.go b/tty.go index b32d19ff..6a31810d 100644 --- a/tty.go +++ b/tty.go @@ -40,7 +40,7 @@ func buildTtyCmd(port int, shell Shell) *exec.Cmd { cmd := exec.Command("ttyd", args...) if shell.Env != nil { - cmd.Env = append(shell.Env, os.Environ()...) + cmd.Env = append(append(shell.Env, os.Environ()...), shell.OverwriteEnv...) } return cmd }