I know using std::process::Command
it's possible to take one child process' output and pipe it into another but when trying to do the same in using tokio::process::Command
I get the trait std::convert::From<tokio::process::ChildStdout>
is not implemented for std::process::Stdio
.
Reading this it seems it's not possible?
Here's a simplified example:
let mut ls_command = Command::new("ls");
ls_command.stdout(Stdio::piped());
let ls_child = ls_command
.spawn()
.expect("Failed to spawn ls command");
let output = Command::new("grep")
.arg("hello")
.stdin(
ls_child
.stdout
.take()
.expect("Failed to take stdout from ls command"),
)
.output();