Skip to content

Commit

Permalink
only set term if rsh is running /bin/sh
Browse files Browse the repository at this point in the history
also set it without using env so it will work in containers
that don't have /bin/env
  • Loading branch information
bparees committed Jan 4, 2017
1 parent a5eaf99 commit 531b6f1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/cmd/cli/cmd/rsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ func (o *RshOptions) Validate() error {
// Run starts a remote shell session on the server
func (o *RshOptions) Run() error {
// Insert the TERM into the command to be run
term := fmt.Sprintf("TERM=%s", util.Env("TERM", "xterm"))
o.Command = append([]string{"env", term}, o.Command...)

if len(o.Command) == 1 && o.Command[0] == "/bin/sh" {
termsh := fmt.Sprintf("TERM=%s /bin/sh", util.Env("TERM", "xterm"))
o.Command = append(o.Command, "-c", termsh)
}
return o.ExecOptions.Run()
}

0 comments on commit 531b6f1

Please sign in to comment.