|
36 | 36 | //! |
37 | 37 | //! # Handling I/O |
38 | 38 | //! |
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: |
44 | 44 | //! |
45 | 45 | //! ``` |
46 | 46 | //! use std::process::{Command, Stdio}; |
|
68 | 68 | //! assert_eq!(b"Oh no, a typo!\n", output.stdout.as_slice()); |
69 | 69 | //! ``` |
70 | 70 | //! |
71 | | -//! Calling a command with input and reading its output: |
| 71 | +//! Note that [`ChildStderr`] and [`ChildStdout`] implement [`Write`] and |
| 72 | +//! [`ChildStdin`] implements [`Read`]: |
72 | 73 | //! |
73 | | -//! ```no_run |
| 74 | +//! ``` |
74 | 75 | //! use std::process::{Command, Stdio}; |
75 | 76 | //! use std::io::Write; |
76 | 77 | //! |
|
101 | 102 | //! [`output`]: struct.Command.html#method.output |
102 | 103 | //! |
103 | 104 | //! [`Child`]: struct.Child.html |
| 105 | +//! [`ChildStdin`]: struct.ChildStdin.html |
| 106 | +//! [`ChildStdout`]: struct.ChildStdout.html |
| 107 | +//! [`ChildStderr`]: struct.ChildStderr.html |
104 | 108 | //! [`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 |
105 | 116 |
|
106 | 117 | #![stable(feature = "process", since = "1.0.0")] |
107 | 118 |
|
|
0 commit comments