From f113a130ae77dc6c5669e2f110fb7b7eb3429e18 Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Fri, 17 Apr 2020 12:22:31 -0400 Subject: [PATCH] sshd: Terminal.Term() fallback to Env TERM --- sshd/terminal.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sshd/terminal.go b/sshd/terminal.go index 239a5eff..e8d99016 100644 --- a/sshd/terminal.go +++ b/sshd/terminal.go @@ -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") }