From 541b0c3af2fad0c5393e15b5fd1a4df2b2349fe7 Mon Sep 17 00:00:00 2001 From: MGlolenstine Date: Wed, 5 May 2021 11:51:05 +0200 Subject: [PATCH] process: updated example (#3748) --- tokio/src/process/mod.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 00e39b05a..96ceb6d8d 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -994,13 +994,22 @@ impl Child { /// If the caller wishes to explicitly control when the child's stdin /// handle is closed, they may `.take()` it before calling `.wait()`: /// - /// ```no_run + /// ``` + /// # #[cfg(not(unix))]fn main(){} + /// # #[cfg(unix)] /// use tokio::io::AsyncWriteExt; + /// # #[cfg(unix)] /// use tokio::process::Command; + /// # #[cfg(unix)] + /// use std::process::Stdio; /// + /// # #[cfg(unix)] /// #[tokio::main] /// async fn main() { - /// let mut child = Command::new("cat").spawn().unwrap(); + /// let mut child = Command::new("cat") + /// .stdin(Stdio::piped()) + /// .spawn() + /// .unwrap(); /// /// let mut stdin = child.stdin.take().unwrap(); /// tokio::spawn(async move {