@@ -885,7 +885,7 @@ impl Command {
885
885
}
886
886
887
887
/// Executes a command as a child process, waiting for it to finish and
888
- /// collecting its exit status.
888
+ /// collecting its status.
889
889
///
890
890
/// By default, stdin, stdout and stderr are inherited from the parent.
891
891
///
@@ -899,7 +899,7 @@ impl Command {
899
899
/// .status()
900
900
/// .expect("failed to execute process");
901
901
///
902
- /// println!("process exited with: {}", status);
902
+ /// println!("process finished with: {}", status);
903
903
///
904
904
/// assert!(status.success());
905
905
/// ```
@@ -1368,11 +1368,17 @@ impl From<fs::File> for Stdio {
1368
1368
1369
1369
/// Describes the result of a process after it has terminated.
1370
1370
///
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.
1372
1372
/// Child processes are created via the [`Command`] struct and their exit
1373
1373
/// status is exposed through the [`status`] method, or the [`wait`] method
1374
1374
/// of a [`Child`] process.
1375
1375
///
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
+ ///
1376
1382
/// [`status`]: Command::status
1377
1383
/// [`wait`]: Child::wait
1378
1384
#[ derive( PartialEq , Eq , Clone , Copy , Debug ) ]
@@ -1400,7 +1406,7 @@ impl ExitStatus {
1400
1406
/// if status.success() {
1401
1407
/// println!("'projects/' directory created");
1402
1408
/// } else {
1403
- /// println!("failed to create 'projects/' directory" );
1409
+ /// println!("failed to create 'projects/' directory: {}", status );
1404
1410
/// }
1405
1411
/// ```
1406
1412
#[ stable( feature = "process" , since = "1.0.0" ) ]
@@ -1410,9 +1416,14 @@ impl ExitStatus {
1410
1416
1411
1417
/// Returns the exit code of the process, if any.
1412
1418
///
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`.
1416
1427
///
1417
1428
/// # Examples
1418
1429
///
0 commit comments