Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶ added in v0.8.15
type Option func(*ptyOptions)
Options represents a an option for a PTY.
func WithGPGTTY ¶ added in v0.14.0
func WithGPGTTY() Option
WithGPGTTY sets the GPG_TTY environment variable to the PTY name. This only applies to non-Windows platforms.
func WithLogger ¶ added in v0.8.15
WithLogger sets a logger for logging errors.
func WithSSHRequest ¶ added in v0.8.15
WithSSHRequest applies the ssh.Pty request to the PTY.
Only partially supported on Windows (e.g. window size).
type PTY ¶
type PTY interface { io.Closer // Name of the TTY. Example on Linux would be "/dev/pts/1". Name() string // Output handles TTY output. // // cmd.SetOutput(pty.Output()) would be used to specify a command // uses the output stream for writing. // // The same stream could be read to validate output. Output() ReadWriter // Input handles TTY input. // // cmd.SetInput(pty.Input()) would be used to specify a command // uses the PTY input for reading. // // The same stream would be used to provide user input: pty.Input().Write(...) Input() ReadWriter // Resize sets the size of the PTY. Resize(height uint16, width uint16) error }
PTY is a minimal interface for interacting with a TTY.
type Process ¶ added in v0.8.2
type Process interface { // Wait for the command to complete. Returned error is as for exec.Cmd.Wait() Wait() error // Kill the command process. Returned error is as for os.Process.Kill() Kill() error }
Process represents a process running in a PTY. We need to trigger special processing on the PTY on process completion, meaning that we will have goroutines calling Wait() on the process. Since the caller will also typically wait for the process, and it is not safe for multiple goroutines to Wait() on a process, this abstraction provides a goroutine-safe interface for interacting with the process.
type ReadWriter ¶ added in v0.6.0
ReadWriter is an implementation of io.ReadWriter that wraps two separate underlying file descriptors, one for reading and one for writing, and allows them to be accessed separately.
type StartOption ¶ added in v0.8.15
type StartOption func(*startOptions)
StartOption represents a configuration option passed to Start.
func WithPTYOption ¶ added in v0.8.15
func WithPTYOption(opts ...Option) StartOption
WithPTYOption applies the given options to the underlying PTY.