about summary refs log tree commit diff
path: root/src/libstd/process.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-05-19 20:41:18 +0000
committerbors <bors@rust-lang.org>2017-05-19 20:41:18 +0000
commit5dfcd85fd4bae49445383baadf472fbdb414a0e6 (patch)
tree6812e7e07285e77a85e3619139280ca3cd09b0a7 /src/libstd/process.rs
parent543691d0ebbbf9e3c996980d2b841794098e5e85 (diff)
parent040cd6d15dcc8c1f66726293d52df93abd2e4b76 (diff)
downloadrust-5dfcd85fd4bae49445383baadf472fbdb414a0e6.tar.gz
rust-5dfcd85fd4bae49445383baadf472fbdb414a0e6.zip
Auto merge of #42105 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 17 pull requests

- Successful merges: #41870, #41910, #41958, #41971, #42006, #42024, #42037, #42056, #42067, #42070, #42079, #42080, #42082, #42089, #42092, #42096, #42100
- Failed merges:
Diffstat (limited to 'src/libstd/process.rs')
-rw-r--r--src/libstd/process.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 3896fc20a2d..d0e7defbbbb 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -754,6 +754,13 @@ impl fmt::Debug for Stdio {
 }
 
 /// Describes the result of a process after it has terminated.
+///
+/// This `struct` is used to represent the exit status of a child process.
+/// Child processes are created via the [`Command`] struct and their exit
+/// status is exposed through the [`status`] method.
+///
+/// [`Command`]: struct.Command.html
+/// [`status`]: struct.Command.html#method.status
 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
 #[stable(feature = "process", since = "1.0.0")]
 pub struct ExitStatus(imp::ExitStatus);
@@ -788,6 +795,22 @@ impl ExitStatus {
     /// On Unix, this will return `None` if the process was terminated
     /// by a signal; `std::os::unix` provides an extension trait for
     /// extracting the signal and other details from the `ExitStatus`.
+    ///
+    /// # Examples
+    ///
+    /// ```no_run
+    /// use std::process::Command;
+    ///
+    /// let status = Command::new("mkdir")
+    ///                      .arg("projects")
+    ///                      .status()
+    ///                      .expect("failed to execute mkdir");
+    ///
+    /// match status.code() {
+    ///     Some(code) => println!("Exited with status code: {}", code),
+    ///     None       => println!("Process terminated by signal")
+    /// }
+    /// ```
     #[stable(feature = "process", since = "1.0.0")]
     pub fn code(&self) -> Option<i32> {
         self.0.code()