Skip to main content

Crate ftui_pty

Crate ftui_pty 

Source
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-pty as a safe, cross-platform abstraction.

§Modules

  • pty_process - Shell process management with spawn(), 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§

CleanupExpectations
Expected cleanup sequences after a session ends.
PtyConfig
Configuration for PTY-backed test sessions.
PtySession
A spawned PTY session with captured output.
ReadUntilOptions
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.