virtual-tty-pty
PTY integration for virtual-tty - run real processes in virtual terminals for integration testing.
Features
- Real Process Execution: Run actual terminal applications (vim, less, bash) in virtual terminals
- PTY Integration: Uses pseudo-TTY for realistic terminal emulation
- Input/Output Control: Send input and capture output from running processes
- Integration Testing: Test your CLI tools against real terminal applications
Usage
use PtyAdapter;
use Command;
// Create a PTY adapter
let mut pty = new?;
// Spawn a command
let mut child = pty.spawn_command?;
// Wait for completion
child.wait?;
// Get the output
println!;
Interactive Sessions
use PtyAdapter;
use Command;
let mut pty = new?;
let mut child = pty.spawn_command?;
// Send commands
pty.send_input_str?;
pty.send_input_str?;
pty.send_input_str?;
child.wait?;
Platform Support
This crate requires Unix-like systems (Linux, macOS) due to PTY API dependencies.
Use Cases
- Integration testing with real terminal applications
- Validating ANSI escape sequence handling
- Testing interactive CLI tools
- Automating terminal-based workflows
License
MIT