Piping tokio child stdout to another tokio process' stdin

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();

Huh, I didn't know that was possible in std. It does seem that the behaviour is indeed not exposed in Tokio.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.