#terminal #shell #winapi

conpty

A library which provides an interface for ConPTY

8 releases (4 breaking)

0.5.1 Mar 31, 2023
0.5.0 Mar 8, 2023
0.4.0 Dec 24, 2022
0.3.0 Dec 21, 2021
0.1.1 Sep 7, 2021

#75 in Windows APIs

Download history 551/week @ 2024-03-14 507/week @ 2024-03-21 446/week @ 2024-03-28 677/week @ 2024-04-04 583/week @ 2024-04-11 535/week @ 2024-04-18 395/week @ 2024-04-25 586/week @ 2024-05-02 479/week @ 2024-05-09 542/week @ 2024-05-16 579/week @ 2024-05-23 479/week @ 2024-05-30 367/week @ 2024-06-06 727/week @ 2024-06-13 792/week @ 2024-06-20 638/week @ 2024-06-27

2,596 downloads per month
Used in 19 crates (3 directly)

MIT license

32KB
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

~130MB
~2M SLoC