Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PTY ¶
PTY holds both sides of a pseudo-terminal pair and the child process.
func Start ¶
Start opens a new PTY, forks the given command onto the slave side with a proper session and controlling terminal, and returns a *PTY whose Master is ready for reading/writing.
argv[0] is the executable path. Pass nil env to inherit.
func StartWithFd ¶
StartWithFd is like Start but also passes extra file descriptors to the child (mapped starting at fd 3). Use this to pass your socketpair alongside the PTY.
func (*PTY) Close ¶
Close shuts down the PTY. Sends SIGHUP to the child (same as closing a real terminal) and closes the master fd.
func (*PTY) Done ¶
func (p *PTY) Done() <-chan struct{}
Done returns a channel that is closed when the child process exits.
func (*PTY) Proxy ¶
Proxy connects the PTY bidirectionally to the outer terminal (os.Stdin/os.Stdout). It puts the outer terminal into raw mode, handles SIGWINCH propagation, and blocks until the child exits. Restores the outer terminal on return.