Skip to content

Commit 3566832

Browse files
committed
Add child process IO handling docs
1 parent f67f662 commit 3566832

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/libstd/process.rs

+18-7
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
//!
3737
//! # Handling I/O
3838
//!
39-
//! TODO
40-
//!
41-
//! # Examples
42-
//!
43-
//! Piping output from one command into another command:
39+
//! The [`stdout`], [`stdin`], and [`stderr`] of a child process can be
40+
//! configured by passing an [`Stdio`] to the corresponding method on
41+
//! [`Command`]. Once spawned, they can be accessed from the [`Child`]. For
42+
//! example, piping output from one command into another command can be done
43+
//! like so:
4444
//!
4545
//! ```
4646
//! use std::process::{Command, Stdio};
@@ -68,9 +68,10 @@
6868
//! assert_eq!(b"Oh no, a typo!\n", output.stdout.as_slice());
6969
//! ```
7070
//!
71-
//! Calling a command with input and reading its output:
71+
//! Note that [`ChildStderr`] and [`ChildStdout`] implement [`Write`] and
72+
//! [`ChildStdin`] implements [`Read`]:
7273
//!
73-
//! ```no_run
74+
//! ```
7475
//! use std::process::{Command, Stdio};
7576
//! use std::io::Write;
7677
//!
@@ -101,7 +102,17 @@
101102
//! [`output`]: struct.Command.html#method.output
102103
//!
103104
//! [`Child`]: struct.Child.html
105+
//! [`ChildStdin`]: struct.ChildStdin.html
106+
//! [`ChildStdout`]: struct.ChildStdout.html
107+
//! [`ChildStderr`]: struct.ChildStderr.html
104108
//! [`Stdio`]: struct.Stdio.html
109+
//!
110+
//! [`stdout`]: struct.Command.html#method.stdout
111+
//! [`stdin`]: struct.Command.html#method.stdin
112+
//! [`stderr`]: struct.Command.html#method.stderr
113+
//!
114+
//! [`Write`]: ../io/trait.Write.html
115+
//! [`Read`]: ../io/trait.Read.html
105116
106117
#![stable(feature = "process", since = "1.0.0")]
107118

0 commit comments

Comments
 (0)