unix ExitStatus: Provide .continued()

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2020-12-12 21:52:17 +00:00
parent f060b9e0d9
commit 42ea8f6434
2 changed files with 15 additions and 0 deletions

View File

@ -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()
}

View File

@ -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
}