We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
std::process::ExitStatus::success
1 parent 3085ec7 commit 27e44edCopy full SHA for 27e44ed
src/libstd/process.rs
@@ -605,6 +605,23 @@ pub struct ExitStatus(imp::ExitStatus);
605
impl ExitStatus {
606
/// Was termination successful? Signal termination not considered a success,
607
/// and success is defined as a zero exit status.
608
+ ///
609
+ /// # Examples
610
611
+ /// ```rust,no_run
612
+ /// use std::process::Command;
613
614
+ /// let status = Command::new("mkdir")
615
+ /// .arg("projects")
616
+ /// .status()
617
+ /// .expect("failed to execute mkdir");
618
619
+ /// if status.success() {
620
+ /// println!("'projects/' directory created");
621
+ /// } else {
622
+ /// println!("failed to create 'projects/' directory");
623
+ /// }
624
+ /// ```
625
#[stable(feature = "process", since = "1.0.0")]
626
pub fn success(&self) -> bool {
627
self.0.success()
0 commit comments