Expand description
POSIX pseudo-terminal allocation — safe wrappers around openpty(3) and friends.
Foundation-layer crate with a single external dependency (libc).
Wraps openpty(), fork(), setsid(), dup2(), execvp(), and
TIOCSWINSZ ioctl behind safe Rust functions.
§Supply Chain Sovereignty
This crate replaces external PTY crates (nix, portable-pty) with a
minimal, auditable wrapper around POSIX system calls. ~250 lines, zero
transitive dependencies beyond libc.
§Primitive Grounding
∂(Boundary) + ς(State) + →(Causality)
Structs§
- PtyPair
- A matched pair of PTY file descriptors (master + slave).
- Spawn
Config - Configuration for spawning a child process in a PTY.
- WinSize
- Terminal dimensions for PTY allocation and resize.
Enums§
- PtyError
- Errors from PTY operations.
Functions§
- fork_
exec - Fork and exec a program in the slave PTY.
- open_
pty - Allocate a new pseudo-terminal pair.
- read_
master - Read bytes from a PTY master fd (synchronous).
- resize
- Resize the terminal via
TIOCSWINSZioctl. - set_
nonblocking - Set a file descriptor to non-blocking mode (
O_NONBLOCK). - signal_
process - Send a signal to a process.
- try_
wait_ pid - Non-blocking wait for child exit status.
- write_
master - Write bytes to a PTY master fd (synchronous).