mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Add TERM iff TERM not defined in container when podman exec -t
Fixes: https://github.com/containers/podman/issues/20334 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -1219,3 +1219,20 @@ func ConvertTimeout(timeout int) uint {
|
||||
}
|
||||
return uint(timeout)
|
||||
}
|
||||
|
||||
// ExecAddTERM when container does not have a TERM environment variable and
|
||||
// caller wants a tty, then leak the existing TERM environment into
|
||||
// the container.
|
||||
func ExecAddTERM(existingEnv []string, execEnvs map[string]string) {
|
||||
if _, ok := execEnvs["TERM"]; ok {
|
||||
return
|
||||
}
|
||||
|
||||
for _, val := range existingEnv {
|
||||
if strings.HasPrefix(val, "TERM=") {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
execEnvs["TERM"] = "xterm"
|
||||
}
|
||||
|
Reference in New Issue
Block a user