@@ -11,6 +11,7 @@ import (
11
11
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
12
12
"k8s.io/kubernetes/pkg/util/term"
13
13
14
+ "github.com/openshift/origin/pkg/cmd/util"
14
15
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
15
16
)
16
17
@@ -24,9 +25,11 @@ This command will attempt to start a shell session in a pod for the specified re
24
25
It works with pods, deployment configs, jobs, daemon sets, and replication controllers.
25
26
Any of the aforementioned resources (apart from pods) will be resolved to a ready pod.
26
27
It will default to the first container if none is specified, and will attempt to use
27
- '/bin/bash ' as the default shell. You may pass an optional command after the resource name,
28
+ '/bin/sh ' as the default shell. You may pass an optional command after the resource name,
28
29
which will be executed instead of a login shell. A TTY will be automatically allocated
29
- if standard input is interactive - use -t and -T to override.
30
+ if standard input is interactive - use -t and -T to override. A TERM variable is sent
31
+ to the environment where the shell (or command) will be executed. By default its value
32
+ is the same as the TERM variable from the local environment; if not set, 'xterm' is used.
30
33
31
34
Note, some containers may not include a shell - use '%[1]s exec' if you need to run commands
32
35
directly.`
@@ -145,5 +148,9 @@ func (o *RshOptions) Validate() error {
145
148
146
149
// Run starts a remote shell session on the server
147
150
func (o * RshOptions ) Run () error {
151
+ // Insert the TERM into the command to be run
152
+ term := fmt .Sprintf ("TERM=%s" , util .Env ("TERM" , "xterm" ))
153
+ o .Command = append ([]string {"env" , term }, o .Command ... )
154
+
148
155
return o .ExecOptions .Run ()
149
156
}
0 commit comments