Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareBundledConPTY ¶ added in v1.31.0
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 NewWithSize ¶
NewWithSize creates a new PTY session with the given initial dimensions. Falls back to 80x24 if cols or rows are 0.
Click to show internal directories.
Click to hide internal directories.