func monitorTerminal(stdOutFD uintptr) { sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGWINCH) defer signal.Stop(sigs) // inform the server what the starting size is resizeTTY(terminal.GetTTYSize(stdOutFD)) for range sigs { resizeTTY(terminal.GetTTYSize(stdOutFD)) } }
func monitorTerminal(stdOutFD uintptr, params string) { sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGWINCH) defer signal.Stop(sigs) for range sigs { w, h := terminal.GetTTYSize(stdOutFD) resizeTTY(stdOutFD, params, w, h) } }
func monitorTerminal(stdOutFD uintptr, params string) { tick := time.Tick(time.Millisecond * 250) // prevW, prevH := terminal.GetTTYSize(stdOutFD) for { select { case <-tick: w, h := terminal.GetTTYSize(stdOutFD) if prevW != w || prevH != h { resizeTTY(stdOutFD, params, w, h) } prevW, prevH = w, h } } }
func monitorTerminal(stdOutFD uintptr) { tick := time.Tick(time.Millisecond * 250) // prevW, prevH := terminal.GetTTYSize(stdOutFD) // inform the server what the starting size is resizeTTY(prevW, prevH) for { select { case <-tick: w, h := terminal.GetTTYSize(stdOutFD) if prevW != w || prevH != h { resizeTTY(w, h) } prevW, prevH = w, h } } }