Skip to content

Commit 6aa7a42

Browse files
authoredApr 17, 2020
Merge pull request #343 from shazow/term-bot-nopty
sshd: Terminal.Term() fallback to Env TERM
2 parents b9aa7a6 + f113a13 commit 6aa7a42

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎sshd/terminal.go

+6-2
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)
Please sign in to comment.