about summary refs log tree commit diff
path: root/library/std/src/sys/unix/ext
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-03-10 08:01:27 +0900
committerGitHub <noreply@github.com>2021-03-10 08:01:27 +0900
commit74e74e9df88d34cf4077afcaac9321cf5eb1a58d (patch)
tree0041741f8e77641978715c0d2d1e502e88be4326 /library/std/src/sys/unix/ext
parentc46f948a8056c9da728969dcc30e4c132d4b4bbb (diff)
parent11ca64401a5d562898e8b5f46bd36d6d1c6dc3ef (diff)
downloadrust-74e74e9df88d34cf4077afcaac9321cf5eb1a58d.tar.gz
rust-74e74e9df88d34cf4077afcaac9321cf5eb1a58d.zip
Rollup merge of #82411 - ijackson:fix-exitstatus, r=dtolnay
Fixes to ExitStatus and its docs

* On Unix, properly display every possible wait status (and don't panic on weird values)
* In the documentation, be clear and consistent about "exit status" vs "wait status".
Diffstat (limited to 'library/std/src/sys/unix/ext')
-rw-r--r--library/std/src/sys/unix/ext/process.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/library/std/src/sys/unix/ext/process.rs b/library/std/src/sys/unix/ext/process.rs
index 88a27f27f66..4e170a8bb1c 100644
--- a/library/std/src/sys/unix/ext/process.rs
+++ b/library/std/src/sys/unix/ext/process.rs
@@ -188,12 +188,20 @@ impl CommandExt for process::Command {
 
 /// Unix-specific extensions to [`process::ExitStatus`].
 ///
+/// On Unix, `ExitStatus` **does not necessarily represent an exit status**, as passed to the
+/// `exit` system call or returned by [`ExitStatus::code()`](crate::process::ExitStatus::code).
+/// It represents **any wait status**, as returned by one of the `wait` family of system calls.
+///
+/// This is because a Unix wait status (a Rust `ExitStatus`) can represent a Unix exit status, but
+/// can also represent other kinds of process event.
+///
 /// This trait is sealed: it cannot be implemented outside the standard library.
 /// This is so that future additional methods are not breaking changes.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait ExitStatusExt: Sealed {
-    /// Creates a new `ExitStatus` from the raw underlying `i32` return value of
-    /// a process.
+    /// Creates a new `ExitStatus` from the raw underlying integer status value from `wait`
+    ///
+    /// The value should be a **wait status, not an exit status**.
     #[stable(feature = "exit_status_from", since = "1.12.0")]
     fn from_raw(raw: i32) -> Self;
 
@@ -222,6 +230,8 @@ pub trait ExitStatusExt: Sealed {
     fn continued(&self) -> bool;
 
     /// Returns the underlying raw `wait` status.
+    ///
+    /// The returned integer is a **wait status, not an exit status**.
     #[unstable(feature = "unix_process_wait_more", issue = "80695")]
     fn into_raw(self) -> i32;
 }