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.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)
|
||||||
|
|||||||
Reference in New Issue
Block a user