about summary refs log tree commit diff
path: root/library/std/src/sys/unix/process/process_unix.rs
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2020-12-12 21:47:47 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2021-01-13 12:50:29 +0000
commitf060b9e0d9277ae522a34ca06312c5857c9aadb0 (patch)
treedb00d03802f37437f69cbf7125b2ff578e594f48 /library/std/src/sys/unix/process/process_unix.rs
parent3f05051d6bcb7b8562577324d59a2435a40992e9 (diff)
downloadrust-f060b9e0d9277ae522a34ca06312c5857c9aadb0.tar.gz
rust-f060b9e0d9277ae522a34ca06312c5857c9aadb0.zip
unix ExitStatus: Provide .stopped_signal()
Necessary to handle WIFSTOPPED.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'library/std/src/sys/unix/process/process_unix.rs')
-rw-r--r--library/std/src/sys/unix/process/process_unix.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs
index 99b1011578a..069a1145f76 100644
--- a/library/std/src/sys/unix/process/process_unix.rs
+++ b/library/std/src/sys/unix/process/process_unix.rs
@@ -486,6 +486,10 @@ impl ExitStatus {
         libc::WIFSIGNALED(self.0) && libc::WCOREDUMP(self.0)
     }
 
+    pub fn stopped_signal(&self) -> Option<i32> {
+        if libc::WIFSTOPPED(self.0) { Some(libc::WSTOPSIG(self.0)) } else { None }
+    }
+
     pub fn into_raw(&self) -> c_int {
         self.0
     }