Warning
This post was published 54 days ago. The information described in this article may have changed.
I'm trying to pipe a program onto another, but I can't call source.wait()
due to source.stdout
being already moved.
use std::process::{Command, Stdio};
fn main() {
let mut source = Command::new("echo").arg("hello").spawn().unwrap();
Command::new("cowsay")
.stdin(source.stdout.unwrap())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()
.unwrap()
.wait()
.unwrap();
let source_status = source.wait().unwrap(); // error here
}
1 post - 1 participant
🏷️ rust_feed