Termisu::Testing::Pty
Allocates a pseudo-terminal and spawns a program attached to it, exposing
the master side as an ordinary IO::FileDescriptor (read it for the child's
output; write to it to deliver input).
SAFETY: spawning goes through Crystal's Process (a fork+exec the runtime is
built for, child reaped via Process#wait). We never call a raw
fork/forkpty — unsafe inside a GC'd, fibered runtime. The child adopts
the PTY slave as its controlling terminal via the ctty-exec shim (see
ctty_exec.cr), so a Termisu app's open("/dev/tty") resolves to our PTY.
Constants
Embedded shim source, so we don't depend on the .cr file existing at runtime.
Constructors
Class methods
Instance methods
The master side of the PTY. A PTY master is a character device, which Crystal treats as non-blocking, so fiber reads yield through the event loop.
Waits for the child to exit and returns its exit code (nil if signalled). Cached; intended to be called after the master reports EOF.
Tells the kernel (and child) about new terminal geometry via TIOCSWINSZ.