Skip to main content

write

Function write 

Source
pub fn write<B: AsRef<[u8]> + Send + 'static>(buf: B) -> Write<B>
Available on crate feature process only.
Expand description

Write an in-memory buffer to child’s stdin.

Budgeting and scheduling of the write task is up to Tokio.

§Example

use cu::pre::*;

let (hello, out) = cu::which("grep")?.command()
    .args(["foo", "-"])
    .stdin(cu::pio::write("foobar\nhello"))
    .stdout(cu::pio::buffer())
    .stderr_null()
    .spawn()?;

assert_eq!(b"foobar\n".to_vec(), out.join()??);