Init PTY after size set
All checks were successful
Build, Test and Push Docker Image / e2e-test (push) Successful in 9s
Build, Test and Push Docker Image / build-and-push (push) Successful in 17s

This commit is contained in:
2025-11-06 21:48:48 +01:00
parent df7adc2237
commit 891e5e0d1b

View File

@@ -133,12 +133,11 @@ func handleChannel(channel ssh.Channel, requests <-chan *ssh.Request) {
cmd.Env = []string{"PATH=/bin", "TERM=xterm"} cmd.Env = []string{"PATH=/bin", "TERM=xterm"}
cmd.Dir = "/" cmd.Dir = "/"
var err error var err error
ptmx, err = pty.Start(cmd) ptmx, err = pty.StartWithSize(cmd, &pty.Winsize{Cols: uint16(termWidth), Rows: uint16(termHeight)})
if err != nil { if err != nil {
log.Println("PTY start error:", err) log.Println("PTY start error:", err)
return return
} }
pty.Setsize(ptmx, &pty.Winsize{Cols: uint16(termWidth), Rows: uint16(termHeight)})
go func() { go func() {
defer ptmx.Close() defer ptmx.Close()
go io.Copy(channel, ptmx) go io.Copy(channel, ptmx)