How 3leaps/sysprims-pty works
sysprims-pty is a cross-platform Rust library for real PTY sessions, opaque-byte I/O, resizing, and owned process containment; its portable_pty-compatible API is a migration path, not the whole product. The principal workflow builds a command, opens a native PTY, performs a single contained spawn, exchanges bytes and resizes, then observes completion or terminates and reaps the owned process tree. Unix and Windows implement containment differently; serial ports provide a separate, non-process-backed TTY capability. Relationships for these paths follow the README and shown source references; unsampled details are not inferred.
Main entry points: conpty.rs ConPTY adapter · lib.rs PTY interfaces · unix.rs Unix PTY · psuedocon.rs Pseudo console
Components 12
PTY API
- Command builder
src/cmdbuilder.rs - PTY interfaces
src/lib.rs - Serial TTY
src/serial.rs
Unix backend
- Unix PTY
src/unix.rs - Session acquisition
src/unix.rs
Windows backend
- ConPTY adapter
src/win/conpty.rs - Pseudo console
src/win/psuedocon.rs - Process attributes
src/win/procthreadattr.rs - Windows child
src/win/mod.rs
Owned lifecycle
- Containment guard
src/lib.rs
Other components
- Application
- sysprims primitives
Connections 17
- Application → Command builder: builds command
README.md - Application → PTY interfaces: opens PTY
README.md - PTY interfaces → Unix PTY: selects backend
src/lib.rs - PTY interfaces → ConPTY adapter: selects backend
- PTY interfaces → Serial TTY: offers serial
src/lib.rs - Application → ConPTY adapter: spawns contained
README.md - Application → Unix PTY: spawns contained
README.md - ConPTY adapter → Command builder: uses command
src/win/conpty.rs - ConPTY adapter → Pseudo console: spawns child
src/win/conpty.rs - Pseudo console → Process attributes: sets attributes
src/win/psuedocon.rs - ConPTY adapter → Windows child: owns child
src/win/conpty.rs - Unix PTY → sysprims primitives: acquires session
README.md - Unix PTY → Containment guard: returns guard
src/unix.rs - ConPTY adapter → Containment guard: returns guard
README.md - Application → Containment guard: observes or terminates
README.md - Application → PTY interfaces: uses byte I/O
README.md - Application → PTY interfaces: resizes PTY
README.md