@@ -885,7 +885,7 @@ impl Command {
885885 }
886886
887887 /// Executes a command as a child process, waiting for it to finish and
888- /// collecting its exit status.
888+ /// collecting its status.
889889 ///
890890 /// By default, stdin, stdout and stderr are inherited from the parent.
891891 ///
@@ -899,7 +899,7 @@ impl Command {
899899 /// .status()
900900 /// .expect("failed to execute process");
901901 ///
902- /// println!("process exited with: {}", status);
902+ /// println!("process finished with: {}", status);
903903 ///
904904 /// assert!(status.success());
905905 /// ```
@@ -1368,11 +1368,17 @@ impl From<fs::File> for Stdio {
13681368
13691369/// Describes the result of a process after it has terminated.
13701370///
1371- /// This `struct` is used to represent the exit status of a child process.
1371+ /// This `struct` is used to represent the exit status or other termination of a child process.
13721372/// Child processes are created via the [`Command`] struct and their exit
13731373/// status is exposed through the [`status`] method, or the [`wait`] method
13741374/// of a [`Child`] process.
13751375///
1376+ /// An `ExitStatus` represents every possible disposition of a process. On Unix this
1377+ /// is the **wait status**. It is *not* simply an *exit status* (a value passed to `exit`).
1378+ ///
1379+ /// For proper error reporting of failed processes, print the value of `ExitStatus` using its
1380+ /// implementation of [`Display`](crate::fmt::Display).
1381+ ///
13761382/// [`status`]: Command::status
13771383/// [`wait`]: Child::wait
13781384#[ derive( PartialEq , Eq , Clone , Copy , Debug ) ]
@@ -1400,7 +1406,7 @@ impl ExitStatus {
14001406 /// if status.success() {
14011407 /// println!("'projects/' directory created");
14021408 /// } else {
1403- /// println!("failed to create 'projects/' directory" );
1409+ /// println!("failed to create 'projects/' directory: {}", status );
14041410 /// }
14051411 /// ```
14061412 #[ stable( feature = "process" , since = "1.0.0" ) ]
@@ -1410,9 +1416,14 @@ impl ExitStatus {
14101416
14111417 /// Returns the exit code of the process, if any.
14121418 ///
1413- /// On Unix, this will return `None` if the process was terminated
1414- /// by a signal; `std::os::unix` provides an extension trait for
1415- /// extracting the signal and other details from the `ExitStatus`.
1419+ /// In Unix terms the return value is the **exit status**: the value passed to `exit`, if the
1420+ /// process finished by calling `exit`. Note that on Unix the exit status is truncated to 8
1421+ /// bits, and that values that didn't come from a program's call to `exit` may be invented the
1422+ /// runtime system (often, for example, 255, 254, 127 or 126).
1423+ ///
1424+ /// On Unix, this will return `None` if the process was terminated by a signal.
1425+ /// [`ExitStatusExt`](crate::os::unix::process::ExitStatusExt) is an
1426+ /// extension trait for extracting any such signal, and other details, from the `ExitStatus`.
14161427 ///
14171428 /// # Examples
14181429 ///
0 commit comments