xpty
Cross-platform async-ready PTY (pseudo terminal) interface for Rust.
Forked from portable-pty (part of wezterm) by Wez Furlong.
Features
- Cross-platform: Unix (openpty) and Windows (ConPTY) support
- Trait-based: Runtime selection of PTY implementations via
PtySystemtrait - Serial port support: Optional serial port TTY via
serialfeature
Usage
use ;
let pty_system = native_pty_system;
let mut pair = pty_system.openpty?;
let cmd = new;
let child = pair.slave.spawn_command?;
let mut reader = pair.master.try_clone_reader?;
writeln!?;
Optional Features
| Feature | Description |
|---|---|
serial |
Serial port TTY support via serial2 |
serde_support |
Serde serialization for PtySize and CommandBuilder |
Relationship to portable-pty
xpty is a fork of portable-pty 0.9.0 with the goal of becoming a more modern, independent cross-platform PTY library. Planned improvements include:
- Async support (tokio/async-std)
- Better Windows ConPTY control
- Improved error types
- Modern Rust idioms (edition 2021+)
License
MIT - see LICENSE.md
Original code by Wez Furlong. See the git history for full attribution.