#win32 #terminal #shell #con-pty

conpty

A library which provides an interface for ConPTY

7 releases (4 breaking)

0.5.0 Mar 8, 2023
0.4.0 Dec 24, 2022
0.3.0 Dec 21, 2021
0.2.1 Sep 12, 2021
0.1.1 Sep 7, 2021

#66 in Windows APIs

Download history 237/week @ 2022-12-02 327/week @ 2022-12-09 319/week @ 2022-12-16 252/week @ 2022-12-23 147/week @ 2022-12-30 266/week @ 2023-01-06 345/week @ 2023-01-13 307/week @ 2023-01-20 487/week @ 2023-01-27 426/week @ 2023-02-03 533/week @ 2023-02-10 570/week @ 2023-02-17 360/week @ 2023-02-24 718/week @ 2023-03-03 285/week @ 2023-03-10 199/week @ 2023-03-17

1,603 downloads per month
Used in 12 crates (via expectrl)

MIT license

31KB
694 lines

conpty Crate docs.rs license

A library which provides an interface for ConPTY.

It is originally developed to be a windows backend for zhiburt/expectrl.

Usage

Include the library to your Cargo.toml.

# Cargo.toml
conpty = "0.5"

Get started

Running echo and reading its output.

use std::io::{Read, Result};

fn main() -> Result<()> {
    let mut proc = conpty::spawn("echo Hello World")?;
    let mut reader = proc.output()?;

    println!("Process has pid={}", proc.pid());

    let mut buf = [0; 1028];
    reader.read(&mut buf)?;

    assert!(String::from_utf8_lossy(&buf).contains("Hello World"));

    Ok(())
}

Dependencies

~169MB
~3M SLoC