Merge pull request #343 from shazow/term-bot-nopty

sshd: Terminal.Term() fallback to Env TERM
This commit is contained in:
Andrey Petrov 2020-04-17 12:28:27 -04:00 committed by GitHub
commit 6aa7a42083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -234,9 +234,13 @@ func (t *Terminal) Env() Env {
}
// 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 {
t.mu.Lock()
defer t.mu.Unlock()
return t.term
if t.term != "" {
return t.term
}
return Env(t.env).Get("TERM")
}