about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2020-12-12 21:52:17 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2021-01-13 12:50:29 +0000
commit42ea8f64347e8c57972a043b00e6c02c9973e7df (patch)
tree8bb792aee6fae8557564614f70ab02446a7b5c5d /library/std/src
parentf060b9e0d9277ae522a34ca06312c5857c9aadb0 (diff)
downloadrust-42ea8f64347e8c57972a043b00e6c02c9973e7df.tar.gz
rust-42ea8f64347e8c57972a043b00e6c02c9973e7df.zip
unix ExitStatus: Provide .continued()
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/unix/ext/process.rs11
-rw-r--r--library/std/src/sys/unix/process/process_unix.rs4
2 files changed, 15 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/ext/process.rs b/library/std/src/sys/unix/ext/process.rs
index 5efe08340f4..6ab109cdb08 100644
--- a/library/std/src/sys/unix/ext/process.rs
+++ b/library/std/src/sys/unix/ext/process.rs
@@ -187,6 +187,13 @@ pub trait ExitStatusExt {
     #[unstable(feature = "unix_process_wait_more", issue = "none")]
     fn stopped_signal(&self) -> Option<i32>;
 
+    /// Whether the process was continued from a stopped status.
+    ///
+    /// Ie, `WIFCONTINUED`.  This is only possible if the status came from a `wait` system call
+    /// which was passed `WCONTINUED`, was then converted into an `ExitStatus`.
+    #[unstable(feature = "unix_process_wait_more", issue = "none")]
+    fn continued(&self) -> bool;
+
     /// Returns the underlying raw `wait` status.
     #[unstable(feature = "unix_process_wait_more", issue = "none")]
     fn into_raw(self) -> i32;
@@ -210,6 +217,10 @@ impl ExitStatusExt for process::ExitStatus {
         self.as_inner().stopped_signal()
     }
 
+    fn continued(&self) -> bool {
+        self.as_inner().continued()
+    }
+
     fn into_raw(self) -> i32 {
         self.as_inner().into_raw().into()
     }
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs
index 069a1145f76..945b43678a9 100644
--- a/library/std/src/sys/unix/process/process_unix.rs
+++ b/library/std/src/sys/unix/process/process_unix.rs
@@ -490,6 +490,10 @@ impl ExitStatus {
         if libc::WIFSTOPPED(self.0) { Some(libc::WSTOPSIG(self.0)) } else { None }
     }
 
+    pub fn continued(&self) -> bool {
+        libc::WIFCONTINUED(self.0)
+    }
+
     pub fn into_raw(&self) -> c_int {
         self.0
     }