process: add documentation to process::Child fields (#3437)

This commit is contained in:
Jacob O'Toole
2021-01-16 19:42:51 +01:00
committed by GitHub
parent 3dc5f6c0ab
commit 7ac44a2d28
+26 -3
View File
@@ -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<ChildStdin>,
/// 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<ChildStdout>,
/// 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<ChildStderr>,
}