Skip to content

Commit 5a0d97c

Browse files
committed
add example for ExitStatus::exit_ok
1 parent 4945db4 commit 5a0d97c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: library/std/src/process.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,16 @@ impl Output {
13031303
/// This is usually correct for command-line applications.
13041304
/// * Capture `stderr` using a custom error type.
13051305
/// This is usually correct for libraries.
1306+
///
1307+
/// # Examples
1308+
///
1309+
/// ```
1310+
/// #![feature(exit_status_error)]
1311+
/// # #[cfg(unix)] {
1312+
/// use std::process::Command;
1313+
/// assert!(Command::new("false").output().exit_ok().is_err());
1314+
/// # }
1315+
/// ```
13061316
#[unstable(feature = "exit_status_error", issue = "84908")]
13071317
pub fn exit_ok(self) -> Result<Self, ExitStatusError> {
13081318
self.status.exit_ok()?;

0 commit comments

Comments
 (0)