func (container *Container) Resize(h, w int) error { pty, ok := container.ptyMaster.(*os.File) if !ok { return fmt.Errorf("ptyMaster does not have Fd() method") } return term.SetWinsize(pty.Fd(), &term.Winsize{Height: uint16(h), Width: uint16(w)}) }
// SetupWindow gets the parent window size and sets the master // pty to the current size and set the parents mode to RAW func (t *TtyTerminal) setupWindow(master, parent *os.File) (*term.State, error) { ws, err := term.GetWinsize(parent.Fd()) if err != nil { return nil, err } if err := term.SetWinsize(master.Fd(), ws); err != nil { return nil, err } return term.SetRawTerminal(parent.Fd()) }
func resizeTty(master *os.File) { if master == nil { return } ws, err := term.GetWinsize(os.Stdin.Fd()) if err != nil { return } if err := term.SetWinsize(master.Fd(), ws); err != nil { return } }
func (t *TtyTerminal) Resize(h, w int) error { return term.SetWinsize(t.master.Fd(), &term.Winsize{Height: uint16(h), Width: uint16(w)}) }
func (t *TtyConsole) Resize(h, w int) error { return term.SetWinsize(t.MasterPty.Fd(), &term.Winsize{Height: uint16(h), Width: uint16(w)}) }