@@ -40,11 +40,15 @@ use thread;
4040/// ```should_panic
4141/// use std::process::Command;
4242///
43- /// let output = Command::new("/bin/cat").arg("file.txt").output().unwrap_or_else(|e| {
44- /// panic!("failed to execute child: {}", e)
45- /// });
46- /// let contents = output.stdout;
47- /// assert!(output.status.success());
43+ /// let mut child = Command::new("/bin/cat")
44+ /// .arg("file.txt")
45+ /// .spawn()
46+ /// .unwrap_or_else(|e| { panic!("failed to execute child: {}", e) });
47+ ///
48+ /// let ecode = child.wait()
49+ /// .unwrap_or_else(|e| { panic!("failed to wait on child: {}", e) });
50+ ///
51+ /// assert!(ecode.success());
4852/// ```
4953#[ stable( feature = "process" , since = "1.0.0" ) ]
5054pub struct Child {
@@ -118,9 +122,11 @@ impl Read for ChildStderr {
118122/// ```
119123/// use std::process::Command;
120124///
121- /// let output = Command::new("sh").arg("-c").arg("echo hello").output().unwrap_or_else(|e| {
122- /// panic!("failed to execute process: {}", e)
123- /// });
125+ /// let output = Command::new("sh")
126+ /// .arg("-c")
127+ /// .arg("echo hello")
128+ /// .output()
129+ /// .unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
124130/// let hello = output.stdout;
125131/// ```
126132#[ stable( feature = "process" , since = "1.0.0" ) ]
@@ -140,7 +146,7 @@ impl Command {
140146 /// * No arguments to the program
141147 /// * Inherit the current process's environment
142148 /// * Inherit the current process's working directory
143- /// * Inherit stdin/stdout/stderr for `run ` or `status`, but create pipes for `output`
149+ /// * Inherit stdin/stdout/stderr for `spawn ` or `status`, but create pipes for `output`
144150 ///
145151 /// Builder methods are provided to change these defaults and
146152 /// otherwise configure the process.
@@ -202,23 +208,20 @@ impl Command {
202208 }
203209
204210 /// Configuration for the child process's stdin handle (file descriptor 0).
205- /// Defaults to `CreatePipe(true, false)` so the input can be written to.
206211 #[ stable( feature = "process" , since = "1.0.0" ) ]
207212 pub fn stdin ( & mut self , cfg : Stdio ) -> & mut Command {
208213 self . stdin = Some ( cfg. 0 ) ;
209214 self
210215 }
211216
212217 /// Configuration for the child process's stdout handle (file descriptor 1).
213- /// Defaults to `CreatePipe(false, true)` so the output can be collected.
214218 #[ stable( feature = "process" , since = "1.0.0" ) ]
215219 pub fn stdout ( & mut self , cfg : Stdio ) -> & mut Command {
216220 self . stdout = Some ( cfg. 0 ) ;
217221 self
218222 }
219223
220224 /// Configuration for the child process's stderr handle (file descriptor 2).
221- /// Defaults to `CreatePipe(false, true)` so the output can be collected.
222225 #[ stable( feature = "process" , since = "1.0.0" ) ]
223226 pub fn stderr ( & mut self , cfg : Stdio ) -> & mut Command {
224227 self . stderr = Some ( cfg. 0 ) ;
@@ -356,7 +359,7 @@ pub struct Output {
356359 pub stderr : Vec < u8 > ,
357360}
358361
359- /// Describes what to do with a standard io stream for a child process.
362+ /// Describes what to do with a standard I/O stream for a child process.
360363#[ stable( feature = "process" , since = "1.0.0" ) ]
361364pub struct Stdio ( StdioImp ) ;
362365
0 commit comments