Expand description
PTY utilities for subprocess-based integration tests.
§Why this exists
FrankenTUI needs PTY-backed tests to validate terminal cleanup behavior and to safely capture subprocess output without corrupting the parent terminal.
§Safety / policy
- This crate forbids unsafe code (
#![forbid(unsafe_code)]). - We use
portable-ptyas a safe, cross-platform abstraction.
§Modules
pty_process- Shell process management withspawn(),kill(),is_alive().virtual_terminal- In-memory terminal state machine for testing.input_forwarding- Key-to-sequence conversion and paste handling.ws_bridge- WebSocket-to-PTY bridge for remote FrankenTerm sessions.
§Role in FrankenTUI
ftui-pty underpins end-to-end and integration tests that need real PTYs.
It is used by the harness and test suites to validate behavior that cannot
be simulated with pure unit tests.
§How it fits in the system
This crate does not participate in the runtime or render pipeline directly.
Instead, it provides test infrastructure used by ftui-harness and E2E
scripts to verify correctness and cleanup behavior.
Modules§
- input_
forwarding - Input forwarding: key events to ANSI sequences. Input forwarding for PTY processes.
- pty_
process - PTY process management for shell spawning and lifecycle control. PTY process management for shell spawning and lifecycle control.
- virtual_
terminal - In-memory virtual terminal state machine for testing. In-memory virtual terminal state machine for testing.
- ws_
bridge - WebSocket-to-PTY bridge for remote terminal sessions. WebSocket-to-PTY bridge for FrankenTerm remote sessions.
Structs§
- Cleanup
Expectations - Expected cleanup sequences after a session ends.
- PtyConfig
- Configuration for PTY-backed test sessions.
- PtySession
- A spawned PTY session with captured output.
- Read
Until Options - Options for
read_until_with_options.
Functions§
- assert_
terminal_ restored - Assert that terminal cleanup sequences were emitted.
- spawn_
command - Spawn a command into a new PTY.