diff --git a/agent/agent.go b/agent/agent.go index 8d509f48f4..a30d466396 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -333,7 +333,7 @@ func (a *agent) handleSSHSession(session ssh.Session) error { } go func() { for win := range windowSize { - err = ptty.Resize(uint16(win.Width), uint16(win.Height)) + err = ptty.Resize(uint16(win.Height), uint16(win.Width)) if err != nil { a.logger.Warn(context.Background(), "failed to resize tty", slog.Error(err)) } diff --git a/pty/pty.go b/pty/pty.go index 0086bfba56..00eb7d33ea 100644 --- a/pty/pty.go +++ b/pty/pty.go @@ -25,7 +25,7 @@ type PTY interface { Input() io.ReadWriter // Resize sets the size of the PTY. - Resize(cols uint16, rows uint16) error + Resize(height uint16, width uint16) error } // New constructs a new Pty. diff --git a/pty/pty_other.go b/pty/pty_other.go index c393387845..5884eb13cc 100644 --- a/pty/pty_other.go +++ b/pty/pty_other.go @@ -42,12 +42,12 @@ func (p *otherPty) Output() io.ReadWriter { } } -func (p *otherPty) Resize(cols uint16, rows uint16) error { +func (p *otherPty) Resize(height uint16, width uint16) error { p.mutex.Lock() defer p.mutex.Unlock() return pty.Setsize(p.pty, &pty.Winsize{ - Rows: rows, - Cols: cols, + Rows: width, + Cols: height, }) } diff --git a/pty/pty_windows.go b/pty/pty_windows.go index 53d6a00548..854ecfe36e 100644 --- a/pty/pty_windows.go +++ b/pty/pty_windows.go @@ -81,11 +81,11 @@ func (p *ptyWindows) Input() io.ReadWriter { } } -func (p *ptyWindows) Resize(cols uint16, rows uint16) error { +func (p *ptyWindows) Resize(height uint16, width uint16) error { // Taken from: https://github.com/microsoft/hcsshim/blob/54a5ad86808d761e3e396aff3e2022840f39f9a8/internal/winapi/zsyscall_windows.go#L144 ret, _, err := procResizePseudoConsole.Call(uintptr(p.console), uintptr(*((*uint32)(unsafe.Pointer(&windows.Coord{ - X: int16(rows), - Y: int16(cols), + Y: int16(height), + X: int16(width), }))))) if ret != 0 { return err