Skip to content

Commit eb71b85

Browse files
authored
fix: session environ should return $TERM (#31)
By default, the TERM environment variable is sent separately in the `pry-req` request when the session is a PTY session. Other environment variables have their own request type `env` and get handled separately. This combines these two and returns a slice that contains TERM and all other sent environment variables. Refs: charmbracelet/bubbletea#1063
1 parent a40c6a0 commit eb71b85

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

session.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ func (sess *session) LocalAddr() net.Addr {
195195
}
196196

197197
func (sess *session) Environ() []string {
198-
return append([]string(nil), sess.env...)
198+
env := append([]string(nil), sess.env...)
199+
if sess.pty != nil {
200+
env = append(env, "TERM="+sess.pty.Term)
201+
}
202+
return env
199203
}
200204

201205
func (sess *session) RawCommand() string {

0 commit comments

Comments
 (0)