mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-08 09:07:44 +00:00
cmd/tsconnect: handle terminal resizes before the SSH session is created
Store the requested size is a struct field, and use that when actually creating the SSH session. Fixes #5567 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
parent
2266b59446
commit
2400ba28b1
@ -343,6 +343,9 @@ type jsSSHSession struct {
|
|||||||
username string
|
username string
|
||||||
termConfig js.Value
|
termConfig js.Value
|
||||||
session *ssh.Session
|
session *ssh.Session
|
||||||
|
|
||||||
|
pendingResizeRows int
|
||||||
|
pendingResizeCols int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *jsSSHSession) Run() {
|
func (s *jsSSHSession) Run() {
|
||||||
@ -413,6 +416,14 @@ func (s *jsSSHSession) Run() {
|
|||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// We might have gotten a resize notification since we started opening the
|
||||||
|
// session, pick up the latest size.
|
||||||
|
if s.pendingResizeRows != 0 {
|
||||||
|
rows = s.pendingResizeRows
|
||||||
|
}
|
||||||
|
if s.pendingResizeCols != 0 {
|
||||||
|
cols = s.pendingResizeCols
|
||||||
|
}
|
||||||
err = session.RequestPty("xterm", rows, cols, ssh.TerminalModes{})
|
err = session.RequestPty("xterm", rows, cols, ssh.TerminalModes{})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -438,6 +449,11 @@ func (s *jsSSHSession) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *jsSSHSession) Resize(rows, cols int) error {
|
func (s *jsSSHSession) Resize(rows, cols int) error {
|
||||||
|
if s.session == nil {
|
||||||
|
s.pendingResizeRows = rows
|
||||||
|
s.pendingResizeCols = cols
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return s.session.WindowChange(rows, cols)
|
return s.session.WindowChange(rows, cols)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user