Skip to content

Commit f113a13

Browse files
committed
sshd: Terminal.Term() fallback to Env TERM
1 parent b9aa7a6 commit f113a13

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sshd/terminal.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,13 @@ func (t *Terminal) Env() Env {
234234
}
235235

236236
// Term returns the terminal string value as set by the pty.
237-
// If there was no pty request, this is empty.
237+
// If there was no pty request, it falls back to the TERM value passed in as an
238+
// Env variable.
238239
func (t *Terminal) Term() string {
239240
t.mu.Lock()
240241
defer t.mu.Unlock()
241-
return t.term
242+
if t.term != "" {
243+
return t.term
244+
}
245+
return Env(t.env).Get("TERM")
242246
}

0 commit comments

Comments
 (0)