@@ -764,14 +764,15 @@ impl Command {
764
764
///
765
765
/// ```should_panic
766
766
/// use std::process::Command;
767
+ /// use std::io::{self, Write};
767
768
/// let output = Command::new("/bin/cat")
768
769
/// .arg("file.txt")
769
770
/// .output()
770
771
/// .expect("failed to execute process");
771
772
///
772
773
/// println!("status: {}", output.status);
773
- /// println!("stdout: {}", String::from_utf8_lossy( &output.stdout));
774
- /// println!("stderr: {}", String::from_utf8_lossy( &output.stderr));
774
+ /// io::stdout().write_all( &output.stdout).unwrap( );
775
+ /// io::stderr().write_all( &output.stderr).unwrap( );
775
776
///
776
777
/// assert!(output.status.success());
777
778
/// ```
@@ -951,14 +952,16 @@ impl Stdio {
951
952
///
952
953
/// ```no_run
953
954
/// use std::process::{Command, Stdio};
955
+ /// use std::io::{self, Write};
954
956
///
955
957
/// let output = Command::new("rev")
956
958
/// .stdin(Stdio::inherit())
957
959
/// .stdout(Stdio::piped())
958
960
/// .output()
959
961
/// .expect("Failed to execute command");
960
962
///
961
- /// println!("You piped in the reverse of: {}", String::from_utf8_lossy(&output.stdout));
963
+ /// print!("You piped in the reverse of: ");
964
+ /// io::stdout().write_all(&output.stdout).unwrap();
962
965
/// ```
963
966
#[ stable( feature = "process" , since = "1.0.0" ) ]
964
967
pub fn inherit ( ) -> Stdio { Stdio ( imp:: Stdio :: Inherit ) }
0 commit comments