1package pty
2
3import "os"
4
5// InheritSize applies the terminal size of pty to tty. This should be run
6// in a signal handler for syscall.SIGWINCH to automatically resize the tty when
7// the pty receives a window size change notification.
8func InheritSize(pty, tty *os.File) error {
9	size, err := GetsizeFull(pty)
10	if err != nil {
11		return err
12	}
13	if err := Setsize(tty, size); err != nil {
14		return err
15	}
16	return nil
17}
18
19// Getsize returns the number of rows (lines) and cols (positions
20// in each line) in terminal t.
21func Getsize(t *os.File) (rows, cols int, err error) {
22	ws, err := GetsizeFull(t)
23	return int(ws.Rows), int(ws.Cols), err
24}
25