From 8047c9f79d698a4e5fb0573b8ba16a7ed51a22e3 Mon Sep 17 00:00:00 2001 From: kylecarbs Date: Mon, 25 Apr 2022 19:04:15 +0000 Subject: [PATCH] fix: Windows resize syscall using incorrect pointer Resizing of PTYs weren't working on Windows before, but they are now! --- pty/pty_windows.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pty/pty_windows.go b/pty/pty_windows.go index fa6f1932a48c3..53d6a00548bfd 100644 --- a/pty/pty_windows.go +++ b/pty/pty_windows.go @@ -82,7 +82,11 @@ func (p *ptyWindows) Input() io.ReadWriter { } func (p *ptyWindows) Resize(cols uint16, rows uint16) error { - ret, _, err := procResizePseudoConsole.Call(uintptr(p.console), uintptr(cols)+(uintptr(rows)<<16)) + // 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), + }))))) if ret != 0 { return err }