conpty

Crates.ioconpty
lib.rsconpty
version0.5.1
sourcesrc
created_at2021-09-06 13:03:47.933047
updated_at2023-03-31 12:30:55.502965
descriptionA library which provides an interface for ConPTY
homepagehttps://github.com/zhiburt/conpty
repositoryhttps://github.com/zhiburt/conpty
max_upload_size
id447516
size50,244
Maxim Zhiburt (zhiburt)

documentation

https://docs.rs/conpty

README

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(())
}
Commit count: 78

cargo fmt