pty

package
v1.52.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareBundledConPTY added in v1.31.0

func PrepareBundledConPTY(string) error

PrepareBundledConPTY is a no-op on platforms with a real PTY; only Windows needs the bundled ConPTY host.

Types

type Session

type Session interface {
	// Start launches the given command in a new PTY.
	Start(cmd string, args ...string) error
	// SetEnv sets additional environment variables to merge with os.Environ()
	// when starting the process. Must be called before Start.
	SetEnv(env []string)
	// SetCWD sets the working directory for the spawned process.
	// Must be called before Start.
	SetCWD(dir string)
	// Read reads output from the PTY.
	Read(buf []byte) (int, error)
	// Write sends input to the PTY.
	Write(data []byte) (int, error)
	// Resize changes the PTY window size.
	Resize(rows, cols uint16) error
	// Close terminates the PTY session and cleans up.
	Close() error
	// Pid returns the process ID of the running command.
	Pid() int
	// WaitExit blocks until the process exits and returns the exit code.
	// Returns -1 if the exit code cannot be determined.
	WaitExit() int
}

Session represents a pseudo-terminal session wrapping a shell process.

func New

func New() Session

func NewWithSize

func NewWithSize(cols, rows int) Session

NewWithSize creates a new PTY session with the given initial dimensions. Falls back to 80x24 if cols or rows are 0.

Directories

Path Synopsis
Package conpty implements Windows Console Pseudo-terminal support.
Package conpty implements Windows Console Pseudo-terminal support.

Jump to

Keyboard shortcuts

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