Init PTY after size set
This commit is contained in:
3
main.go
3
main.go
@@ -133,12 +133,11 @@ func handleChannel(channel ssh.Channel, requests <-chan *ssh.Request) {
|
||||
cmd.Env = []string{"PATH=/bin", "TERM=xterm"}
|
||||
cmd.Dir = "/"
|
||||
var err error
|
||||
ptmx, err = pty.Start(cmd)
|
||||
ptmx, err = pty.StartWithSize(cmd, &pty.Winsize{Cols: uint16(termWidth), Rows: uint16(termHeight)})
|
||||
if err != nil {
|
||||
log.Println("PTY start error:", err)
|
||||
return
|
||||
}
|
||||
pty.Setsize(ptmx, &pty.Winsize{Cols: uint16(termWidth), Rows: uint16(termHeight)})
|
||||
go func() {
|
||||
defer ptmx.Close()
|
||||
go io.Copy(channel, ptmx)
|
||||
|
||||
Reference in New Issue
Block a user