Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions library/std/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,20 +461,21 @@ impl fmt::Debug for ChildStderr {
/// ```
/// use std::process::Command;
///
/// let output = if cfg!(target_os = "windows") {
/// Command::new("cmd")
/// if cfg!(target_os = "windows") {
/// let output = Command::new("cmd")
/// .args(["/C", "echo hello"])
/// .output()
/// .expect("failed to execute process")
/// .expect("failed to execute process");
/// assert_eq!(String::from_utf8_lossy(&output.stdout), "hello\r\n");
/// } else {
/// Command::new("sh")
/// let output = Command::new("sh")
/// .arg("-c")
/// .arg("echo hello")
/// .output()
/// .expect("failed to execute process")
/// .expect("failed to execute process");
/// assert_eq!(String::from_utf8_lossy(&output.stdout), "hello\n");
/// };
///
/// let hello = output.stdout;
/// ```
///
/// `Command` can be reused to spawn multiple processes. The builder methods
Expand Down