Skip to content

Commit

Permalink
Merge pull request #343 from shazow/term-bot-nopty
Browse files Browse the repository at this point in the history
sshd: Terminal.Term() fallback to Env TERM
  • Loading branch information
shazow authored Apr 17, 2020
2 parents b9aa7a6 + f113a13 commit 6aa7a42
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sshd/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 6aa7a42

Please sign in to comment.