Rollup merge of #34794 - frewsxcv:exitstatus-success, r=GuillaumeGomez
Add doc example for `std::process::ExitStatus::success`. None
This commit is contained in:
commit
367f942ce4
@ -605,6 +605,23 @@ pub struct ExitStatus(imp::ExitStatus);
|
|||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
/// Was termination successful? Signal termination not considered a success,
|
/// Was termination successful? Signal termination not considered a success,
|
||||||
/// and success is defined as a zero exit status.
|
/// and success is defined as a zero exit status.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```rust,no_run
|
||||||
|
/// use std::process::Command;
|
||||||
|
///
|
||||||
|
/// let status = Command::new("mkdir")
|
||||||
|
/// .arg("projects")
|
||||||
|
/// .status()
|
||||||
|
/// .expect("failed to execute mkdir");
|
||||||
|
///
|
||||||
|
/// if status.success() {
|
||||||
|
/// println!("'projects/' directory created");
|
||||||
|
/// } else {
|
||||||
|
/// println!("failed to create 'projects/' directory");
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
#[stable(feature = "process", since = "1.0.0")]
|
#[stable(feature = "process", since = "1.0.0")]
|
||||||
pub fn success(&self) -> bool {
|
pub fn success(&self) -> bool {
|
||||||
self.0.success()
|
self.0.success()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user