From 7ac44a2d28f5967851ae6ad0d6d8d4666a26cf6f Mon Sep 17 00:00:00 2001 From: Jacob O'Toole Date: Sat, 16 Jan 2021 18:42:51 +0000 Subject: [PATCH] process: add documentation to process::Child fields (#3437) --- tokio/src/process/mod.rs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index bd23e1f73..bed50a7aa 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -839,15 +839,38 @@ pub struct Child { child: FusedChild, /// The handle for writing to the child's standard input (stdin), if it has - /// been captured. + /// been captured. To avoid partially moving the `child` and thus blocking + /// yourself from calling functions on `child` while using `stdin`, you might + /// find it helpful to do: + /// + /// ```no_run + /// # let mut child = tokio::process::Command::new("echo").spawn().unwrap(); + /// let stdin = child.stdin.take().unwrap(); + /// ``` pub stdin: Option, /// The handle for reading from the child's standard output (stdout), if it - /// has been captured. + /// has been captured. You might find it helpful to do + /// + /// ```no_run + /// # let mut child = tokio::process::Command::new("echo").spawn().unwrap(); + /// let stdout = child.stdout.take().unwrap(); + /// ``` + /// + /// to avoid partially moving the `child` and thus blocking yourself from calling + /// functions on `child` while using `stdout`. pub stdout: Option, /// The handle for reading from the child's standard error (stderr), if it - /// has been captured. + /// has been captured. You might find it helpful to do + /// + /// ```no_run + /// # let mut child = tokio::process::Command::new("echo").spawn().unwrap(); + /// let stderr = child.stderr.take().unwrap(); + /// ``` + /// + /// to avoid partially moving the `child` and thus blocking yourself from calling + /// functions on `child` while using `stderr`. pub stderr: Option, }