rust-pty

Crates.iorust-pty
lib.rsrust-pty
version0.1.0
created_at2026-01-05 22:00:27.269635+00
updated_at2026-01-05 22:00:27.269635+00
descriptionCross-platform async PTY (pseudo-terminal) library for Rust
homepage
repositoryhttps://github.com/praxiomlabs/rust-expect
max_upload_size
id2024653
size121,853
Justin (jkindrix)

documentation

README

rust-pty

Low-level pseudo-terminal (PTY) abstraction for Rust.

Features

  • Async I/O with Tokio
  • PTY allocation and configuration
  • Window size management
  • Child process spawning
  • Signal handling

Usage

use rust_pty::{PtyConfig, UnixPtyMaster, spawn_with_pty};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = PtyConfig::default()
        .window_size(80, 24);

    let (master, child) = spawn_with_pty("bash", &config)?;

    // Use master for I/O
    // master.write_all(b"echo hello\n").await?;

    Ok(())
}

Platform Support

  • Unix: Linux, macOS, BSD (via rustix PTY)
  • Windows: Windows 10 1809+ (via ConPTY)

License

Licensed under MIT or Apache-2.0.

Commit count: 89

cargo fmt