Skip to content

Commit 19d1f5e

Browse files
committed
---
yaml --- r: 275357 b: refs/heads/master c: 0dd5f67 h: refs/heads/master i: 275355: 6c4fe8f
1 parent 9e66712 commit 19d1f5e

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 45517947ba9a69260e5b3f4fe54a9aa21ed703eb
2+
refs/heads/master: 0dd5f67f4af2f071fa435dc0487d3678d3cf40dd
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/libstd/process.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ use sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
3838
/// let mut child = Command::new("/bin/cat")
3939
/// .arg("file.txt")
4040
/// .spawn()
41-
/// .unwrap_or_else(|e| { panic!("failed to execute child: {}", e) });
41+
/// .expect("failed to execute child");
4242
///
4343
/// let ecode = child.wait()
44-
/// .unwrap_or_else(|e| { panic!("failed to wait on child: {}", e) });
44+
/// .expect("failed to wait on child");
4545
///
4646
/// assert!(ecode.success());
4747
/// ```
@@ -195,7 +195,8 @@ impl FromInner<AnonPipe> for ChildStderr {
195195
/// .arg("-c")
196196
/// .arg("echo hello")
197197
/// .output()
198-
/// .unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
198+
/// .expect("failed to execute proces");
199+
///
199200
/// let hello = output.stdout;
200201
/// ```
201202
#[stable(feature = "process", since = "1.0.0")]
@@ -305,11 +306,10 @@ impl Command {
305306
///
306307
/// # Examples
307308
///
308-
/// ```
309+
/// ```should_panic
309310
/// use std::process::Command;
310-
/// let output = Command::new("cat").arg("foo.txt").output().unwrap_or_else(|e| {
311-
/// panic!("failed to execute process: {}", e)
312-
/// });
311+
/// let output = Command::new("/bin/cat").arg("file.txt").output()
312+
/// .expect("failed to execute process");
313313
///
314314
/// println!("status: {}", output.status);
315315
/// println!("stdout: {}", String::from_utf8_lossy(&output.stdout));
@@ -328,12 +328,11 @@ impl Command {
328328
///
329329
/// # Examples
330330
///
331-
/// ```
331+
/// ```should_panic
332332
/// use std::process::Command;
333333
///
334-
/// let status = Command::new("ls").status().unwrap_or_else(|e| {
335-
/// panic!("failed to execute process: {}", e)
336-
/// });
334+
/// let status = Command::new("/bin/cat").arg("file.txt").status()
335+
/// .expect("failed to execute process");
337336
///
338337
/// println!("process exited with: {}", status);
339338
/// ```
@@ -511,13 +510,13 @@ impl Child {
511510
/// use std::process::{Command, Stdio};
512511
///
513512
/// let mut child = Command::new("/bin/cat")
514-
/// .stdout(Stdio::piped())
515513
/// .arg("file.txt")
514+
/// .stdout(Stdio::piped())
516515
/// .spawn()
517-
/// .unwrap_or_else(|e| { panic!("failed to execute child: {}", e) });
516+
/// .expect("failed to execute child");
518517
///
519518
/// let ecode = child.wait_with_output()
520-
/// .unwrap_or_else(|e| { panic!("failed to wait on child: {}", e) });
519+
/// .expect("failed to wait on child");
521520
///
522521
/// assert!(ecode.success());
523522
/// ```

0 commit comments

Comments
 (0)