Documentation ¶
Index ¶
- Variables
- func WaitProcess(ctx context.Context, cmd *exec.Cmd) (err error)
- type ConPty
- type Options
- type Pty
- type PtyOption
- type UnixPty
- func (p *UnixPty) Close() (err error)
- func (p *UnixPty) Control(fn func(fd uintptr)) error
- func (p *UnixPty) Fd() uintptr
- func (p *UnixPty) Master() *os.File
- func (p *UnixPty) Name() string
- func (p *UnixPty) Read(b []byte) (n int, err error)
- func (p *UnixPty) Resize(width int, height int) (err error)
- func (p *UnixPty) SetWinsize(width, height, x, y int) error
- func (p *UnixPty) Size() (width, height int, err error)
- func (p *UnixPty) Slave() *os.File
- func (p *UnixPty) SlaveName() string
- func (p *UnixPty) Start(c *exec.Cmd) error
- func (p *UnixPty) Write(b []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupported = pty.ErrUnsupported
ErrUnsupported is returned when a feature is not supported.
Functions ¶
Types ¶
type Pty ¶
type Pty interface { term.File io.ReadWriteCloser // Resize resizes the PTY. Resize(width, height int) error // Size returns the size of the PTY. Size() (width, height int, err error) // Name returns the name of the PTY. Name() string // Start starts a command on the PTY. // The command started will have its standard input, output, and error // connected to the PTY. // On Windows, calling Wait won't work since the Go runtime doesn't handle // ConPTY processes correctly. See https://github.com/golang/go/pull/62710. Start(cmd *exec.Cmd) error }
Pty represents a PTY (pseudo-terminal) interface.
func NewPty ¶
NewPty creates a new PTY.
The returned PTY will be a Unix PTY on Unix systems and a ConPTY on Windows. The width and height parameters specify the initial size of the PTY. You can pass additional options to the PTY by passing PtyOptions.
pty, err := xpty.NewPty(80, 24) if err != nil { // handle error } defer pty.Close() // Make sure to close the PTY when done. switch pty := pty.(type) { case xpty.UnixPty: // Unix PTY case xpty.ConPty: // ConPTY }
type UnixPty ¶
type UnixPty struct {
// contains filtered or unexported fields
}
UnixPty represents a classic Unix PTY (pseudo-terminal).
func NewUnixPty ¶
NewUnixPty creates a new Unix PTY.
func (*UnixPty) Control ¶
Control runs the given function with the file descriptor of the master PTY.
func (*UnixPty) SetWinsize ¶
SetWinsize sets window size for the PTY.
Click to show internal directories.
Click to hide internal directories.