pty

package
v7.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package pty provides basic pty support. It implments much of exec.Command but the Start() function starts two goroutines that relay the data for Stdin, Stdout, and Stdout such that proper kernel pty processing is done. We did not simply embed an exec.Command as we can no guarantee that we can implement all aspects of it for all time to come.

Package pty provides basic pty support. It implments much of exec.Command but the Start() function starts two goroutines that relay the data for Stdin, Stdout, and Stdout such that proper kernel pty processing is done. We did not simply embed an exec.Command as we can no guarantee that we can implement all aspects of it for all time to come.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pty

type Pty struct {
	C        *exec.Cmd
	Ptm      *os.File
	Pts      *os.File
	Sname    string
	Kid      int
	TTY      *termios.TTYIO
	WS       *termios.Winsize
	Restorer *termios.Termios
}

Pty contains all the bits and pieces needed to start and control a process at the other end of a pty, as well as whatever is needed to control the pty, and restore modes on exit.

func New

func New() (*Pty, error)

New returns a new Pty.

func (*Pty) Command

func (p *Pty) Command(cmd string, args ...string)

Command sets up an exec.Command at the remote end of a Pty.

func (*Pty) Run

func (p *Pty) Run() error

Run runs a Command attached to a Pty, waiting for completion and managing stdio. It uses Wait to restore tty modes when it is done.

func (*Pty) Start

func (p *Pty) Start() error

Start starts Command attached to a Pty. It sets window size and other variables as needed. It does not block.

func (*Pty) Wait

func (p *Pty) Wait() error

Wait waits for a previously started command to finish, and restores the tty mode when it is done.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL