pub type ProcessChunkStream = ChildStream<ReaderStream<BufReader<ChildStdout>>, ReaderStream<BufReader<ChildStderr>>>;Expand description
ChildStream that produces chunks that may part of a line or multiple lines.
§Example
use tokio_process_stream::{Item, ProcessChunkStream};
use tokio::process::Command;
use tokio_stream::StreamExt;
// Example of a process that prints onto a single line using '\r'.
let mut procstream: ProcessChunkStream = Command::new("/bin/sh")
.arg("-c")
.arg(r#"printf "1/2"; sleep 0.1; printf "\r2/2 done\n""#)
.try_into()?;
assert_eq!(
procstream.next().await.as_ref().and_then(|n| n.stdout()),
Some(b"1/2" as _)
);
assert_eq!(
procstream.next().await.as_ref().and_then(|n| n.stdout()),
Some(b"\r2/2 done\n" as _)
);
assert!(matches!(procstream.next().await, Some(Item::Done(_))));Aliased Type§
pub struct ProcessChunkStream { /* private fields */ }