Crates.io | conpty |
lib.rs | conpty |
version | 0.7.0 |
source | src |
created_at | 2021-09-06 13:03:47.933047 |
updated_at | 2024-09-23 20:38:42.345648 |
description | A library which provides an interface for ConPTY |
homepage | https://github.com/zhiburt/conpty |
repository | https://github.com/zhiburt/conpty |
max_upload_size | |
id | 447516 |
size | 55,480 |
A library which provides an interface for ConPTY.
It is originally developed to be a windows backend for zhiburt/expectrl.
Include the library to your Cargo.toml
.
# Cargo.toml
conpty = "0.5"
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(())
}