Documentation ¶
Overview ¶
Package pty provides functions for working with Unix terminals.
Index ¶
- Variables
- func Getsize(t *os.File) (rows, cols int, err error)
- func InheritSize(pty, tty *os.File) error
- func Open() (pty, tty *os.File, err error)
- func Setsize(t *os.File, ws *Winsize) error
- func Start(c *exec.Cmd) (pty *os.File, err error)
- func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error)
- type Winsize
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("unsupported")
ErrUnsupported is returned if a function is not available on the current platform.
Functions ¶
func Getsize ¶
Getsize returns the number of rows (lines) and cols (positions in each line) in terminal t.
func InheritSize ¶ added in v1.1.0
InheritSize applies the terminal size of pty to tty. This should be run in a signal handler for syscall.SIGWINCH to automatically resize the tty when the pty receives a window size change notification.
func Start ¶
Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, and c.Stderr, calls c.Start, and returns the File of the tty's corresponding pty.
func StartWithSize ¶ added in v1.1.3
StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, and c.Stderr, calls c.Start, and returns the File of the tty's corresponding pty.
This will resize the pty to the specified size before starting the command