golazy.dev
–
golazy.dev
/
lazytui
/
pty
Index
|
Files
package pty ¶
import "golazy.dev/lazytui/pty"
Variables ¶
var ErrInvalidCommand, ErrNotStarted, ErrAlreadyStarted ¶
var (
ErrInvalidCommand = errors.New("invalid pty command")
ErrNotStarted = errors.New("pty command not started")
ErrAlreadyStarted = errors.New("pty command already started")
)
Types ¶
type Cmd ¶
Cmd is a command connected to a pseudo terminal.
type Cmd struct {
Path string
Args []string
Env []string
Dir string
Size tty.Size
Stdin io.Reader
Stdout io.Writer
// contains filtered or unexported fields
}
func Command ¶
Command returns a new pseudo-terminal command.
func Command(path string, args ...string) *Cmd
func CommandContext ¶
CommandContext returns a new pseudo-terminal command with a context.
func CommandContext(ctx context.Context, path string, args ...string) *Cmd
func (c *Cmd) Master ¶
Master returns the master side of the pseudo terminal after Start.
func (c *Cmd) Master() *os.File
func (c *Cmd) Process ¶
Process returns the started process, if any.
func (c *Cmd) Process() *os.Process
func (c *Cmd) Resize ¶
Resize changes the child terminal size.
func (c *Cmd) Resize(size tty.Size) error
func (c *Cmd) Run ¶
Run starts the command and waits for it to finish.
func (c *Cmd) Run() error
func (c *Cmd) Start ¶
Start starts the command connected to a pseudo terminal.
func (c *Cmd) Start() error
func (c *Cmd) Wait ¶
Wait waits for the command to finish and closes the pseudo-terminal master.
func (c *Cmd) Wait() error
Package pty starts commands behind pseudo terminals.
It is the process side of Lazy Terminal's fake terminal work: callers assign cell sizes to a child process, and the backend exposes those sizes through the operating system's terminal ioctl layer.