sshd: Terminal.Term() fallback to Env TERM

This commit is contained in:
Andrey Petrov 2020-04-17 12:22:31 -04:00
parent b9aa7a6a0c
commit f113a130ae

View File

@ -234,9 +234,13 @@ func (t *Terminal) Env() Env {
} }
// Term returns the terminal string value as set by the pty. // Term returns the terminal string value as set by the pty.
// If there was no pty request, this is empty. // If there was no pty request, it falls back to the TERM value passed in as an
// Env variable.
func (t *Terminal) Term() string { func (t *Terminal) Term() string {
t.mu.Lock() t.mu.Lock()
defer t.mu.Unlock() defer t.mu.Unlock()
return t.term if t.term != "" {
return t.term
}
return Env(t.env).Get("TERM")
} }