unix ExitStatus: Provide .into_raw()
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
parent
12d62aa436
commit
530270f94a
@ -175,6 +175,10 @@ pub trait ExitStatusExt {
|
||||
/// Ie, if `WIFSIGNALED`, this returns `WTERMSIG`.
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn signal(&self) -> Option<i32>;
|
||||
|
||||
/// Returns the underlying raw `wait` status.
|
||||
#[unstable(feature = "unix_process_wait_more", issue = "none")]
|
||||
fn into_raw(self) -> i32;
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
@ -186,6 +190,10 @@ impl ExitStatusExt for process::ExitStatus {
|
||||
fn signal(&self) -> Option<i32> {
|
||||
self.as_inner().signal()
|
||||
}
|
||||
|
||||
fn into_raw(self) -> i32 {
|
||||
self.as_inner().into_raw().into()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "process_extensions", since = "1.2.0")]
|
||||
|
@ -481,6 +481,10 @@ impl ExitStatus {
|
||||
pub fn signal(&self) -> Option<i32> {
|
||||
if libc::WIFSIGNALED(self.0) { Some(libc::WTERMSIG(self.0)) } else { None }
|
||||
}
|
||||
|
||||
pub fn into_raw(&self) -> c_int {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a raw `c_int` to a type-safe `ExitStatus` by wrapping it without copying.
|
||||
|
Loading…
Reference in New Issue
Block a user