Skip to content

Commit 42ea8f6

Browse files
committed
unix ExitStatus: Provide .continued()
Signed-off-by: Ian Jackson <[email protected]>
1 parent f060b9e commit 42ea8f6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

library/std/src/sys/unix/ext/process.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ pub trait ExitStatusExt {
187187
#[unstable(feature = "unix_process_wait_more", issue = "none")]
188188
fn stopped_signal(&self) -> Option<i32>;
189189

190+
/// Whether the process was continued from a stopped status.
191+
///
192+
/// Ie, `WIFCONTINUED`. This is only possible if the status came from a `wait` system call
193+
/// which was passed `WCONTINUED`, was then converted into an `ExitStatus`.
194+
#[unstable(feature = "unix_process_wait_more", issue = "none")]
195+
fn continued(&self) -> bool;
196+
190197
/// Returns the underlying raw `wait` status.
191198
#[unstable(feature = "unix_process_wait_more", issue = "none")]
192199
fn into_raw(self) -> i32;
@@ -210,6 +217,10 @@ impl ExitStatusExt for process::ExitStatus {
210217
self.as_inner().stopped_signal()
211218
}
212219

220+
fn continued(&self) -> bool {
221+
self.as_inner().continued()
222+
}
223+
213224
fn into_raw(self) -> i32 {
214225
self.as_inner().into_raw().into()
215226
}

library/std/src/sys/unix/process/process_unix.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,10 @@ impl ExitStatus {
490490
if libc::WIFSTOPPED(self.0) { Some(libc::WSTOPSIG(self.0)) } else { None }
491491
}
492492

493+
pub fn continued(&self) -> bool {
494+
libc::WIFCONTINUED(self.0)
495+
}
496+
493497
pub fn into_raw(&self) -> c_int {
494498
self.0
495499
}

0 commit comments

Comments
 (0)