Versions in this module Expand all Collapse all v1 v1.0.0 Sep 23, 2026 Changes in this version + const DefaultHeight + const DefaultWidth + const ModeCS7 + const ModeCS8 + const ModeECHO + const ModeECHOCTL + const ModeECHOE + const ModeECHOK + const ModeECHOKE + const ModeECHONL + const ModeICANON + const ModeICRNL + const ModeIEXTEN + const ModeIGNCR + const ModeIGNPAR + const ModeIMAXBEL + const ModeINLCR + const ModeINPCK + const ModeISIG + const ModeISTRIP + const ModeIUCLC + const ModeIUTF8 + const ModeIXANY + const ModeIXOFF + const ModeIXON + const ModeNOFLSH + const ModeOCRNL + const ModeOLCUC + const ModeONLCR + const ModeONLRET + const ModeONOCR + const ModeOPOST + const ModePARENB + const ModePARMRK + const ModePARODD + const ModePENDIN + const ModeTOSTOP + const ModeTTYOpISpeed + const ModeTTYOpOSpeed + const ModeVDISCARD + const ModeVDSUSP + const ModeVEOF + const ModeVEOL + const ModeVEOL2 + const ModeVERASE + const ModeVFLUSH + const ModeVINTR + const ModeVKILL + const ModeVLNEXT + const ModeVMIN + const ModeVQUIT + const ModeVREPRINT + const ModeVSTART + const ModeVSTATUS + const ModeVSTOP + const ModeVSUSP + const ModeVSWTCH + const ModeVTIME + const ModeVWERASE + const ModeXCASE + var ErrInvalidCommand = errors.New("pty: invalid command") + var ErrNilContext = errors.New("pty: nil context") + var ErrUnsupported = errors.New("pty: unsupported") + func ApplyTerminalModes(fd int, width, height int, modes map[uint8]uint32) error + func CreatePipes() (inPipeRead, inPipeWrite, outPipeRead, outPipeWrite uintptr, err error) + func GetSize(tty *os.File) (rows, cols int, err error) + func InheritSize(from, to *os.File) error + func Open() (ptmx, tty *os.File, err error) + func SetSize(*os.File, *Winsize) error — js/wasm, windows/amd64 + func SetSize(tty *os.File, size *Winsize) error — darwin/amd64, linux/amd64 + func Start(cmd *exec.Cmd) (*os.File, error) + func StartWithAttr(cmd *exec.Cmd, size *Winsize, attrs *syscall.SysProcAttr) (*os.File, error) + func StartWithSize(*exec.Cmd, *Winsize) (*os.File, error) — js/wasm, windows/amd64 + func StartWithSize(cmd *exec.Cmd, size *Winsize) (*os.File, error) — darwin/amd64, linux/amd64 + type Cmd struct + Args []string + Cancel func() error + Dir string + Env []string + Path string + Process *os.Process + ProcessState *os.ProcessState + SysProcAttr *syscall.SysProcAttr + func (c *Cmd) Run() error + func (c *Cmd) Start() error + func (c *Cmd) Wait() error + type ConPTY struct + func NewConPTY(width, height, flags int) (*ConPTY, error) + func NewConPTYWithPipes(inPipeRead, inPipeWrite, outPipeRead, outPipeWrite uintptr, ...) (*ConPTY, error) + func (*ConPTY) Close() error + func (*ConPTY) Fd() uintptr + func (*ConPTY) InPipeReadFd() uintptr + func (*ConPTY) InPipeWriteFd() uintptr + func (*ConPTY) OutPipeReadFd() uintptr + func (*ConPTY) OutPipeWriteFd() uintptr + func (*ConPTY) Read([]byte) (int, error) + func (*ConPTY) Resize(width, height int) error + func (*ConPTY) Size() (int, int, error) + func (*ConPTY) Spawn(name string, args []string, attr *syscall.ProcAttr) (pid int, handle uintptr, err error) + func (*ConPTY) Write([]byte) (int, error) + func (c *ConPTY) Close() error + func (c *ConPTY) Command(name string, args ...string) *Cmd + func (c *ConPTY) CommandContext(ctx context.Context, name string, args ...string) *Cmd + func (c *ConPTY) Fd() uintptr + func (c *ConPTY) InPipeReadFd() uintptr + func (c *ConPTY) InPipeWriteFd() uintptr + func (c *ConPTY) OutPipeReadFd() uintptr + func (c *ConPTY) OutPipeWriteFd() uintptr + func (c *ConPTY) Read(buf []byte) (n int, err error) + func (c *ConPTY) Resize(width, height int) error + func (c *ConPTY) Size() (width, height int, err error) + func (c *ConPTY) Spawn(name string, args []string, attr *syscall.ProcAttr) (pid int, handle uintptr, err error) + func (c *ConPTY) Write(data []byte) (n int, err error) + type Terminal interface + Command func(name string, args ...string) *Cmd + CommandContext func(ctx context.Context, name string, args ...string) *Cmd + Resize func(width, height int) error + Size func() (width, height int, err error) + type VirtualPTY struct + func NewVirtualPTY(width, height int) *VirtualPTY + func (v *VirtualPTY) Close() error + func (v *VirtualPTY) Command(name string, args ...string) *Cmd + func (v *VirtualPTY) CommandContext(ctx context.Context, name string, args ...string) *Cmd + func (v *VirtualPTY) OnInterrupt(handler func()) + func (v *VirtualPTY) Read(p []byte) (int, error) + func (v *VirtualPTY) Resize(width, height int) error + func (v *VirtualPTY) SetRaw(raw bool) + func (v *VirtualPTY) Size() (width, height int, err error) + func (v *VirtualPTY) Slave() io.ReadWriteCloser + func (v *VirtualPTY) Write(p []byte) (int, error) + type Winsize struct + Cols uint16 + Rows uint16 + X uint16 + Y uint16 + func GetFullSize(*os.File) (*Winsize, error) + func GetFullSize(tty *os.File) (*Winsize, error)