Skip to content

Commit 530270f

Browse files
committed
unix ExitStatus: Provide .into_raw()
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
1 parent 12d62aa commit 530270f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ pub trait ExitStatusExt {
175175
/// Ie, if `WIFSIGNALED`, this returns `WTERMSIG`.
176176
#[stable(feature = "rust1", since = "1.0.0")]
177177
fn signal(&self) -> Option<i32>;
178+
179+
/// Returns the underlying raw `wait` status.
180+
#[unstable(feature = "unix_process_wait_more", issue = "none")]
181+
fn into_raw(self) -> i32;
178182
}
179183

180184
#[stable(feature = "rust1", since = "1.0.0")]
@@ -186,6 +190,10 @@ impl ExitStatusExt for process::ExitStatus {
186190
fn signal(&self) -> Option<i32> {
187191
self.as_inner().signal()
188192
}
193+
194+
fn into_raw(self) -> i32 {
195+
self.as_inner().into_raw().into()
196+
}
189197
}
190198

191199
#[stable(feature = "process_extensions", since = "1.2.0")]

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,10 @@ impl ExitStatus {
481481
pub fn signal(&self) -> Option<i32> {
482482
if libc::WIFSIGNALED(self.0) { Some(libc::WTERMSIG(self.0)) } else { None }
483483
}
484+
485+
pub fn into_raw(&self) -> c_int {
486+
self.0
487+
}
484488
}
485489

486490
/// Converts a raw `c_int` to a type-safe `ExitStatus` by wrapping it without copying.

0 commit comments

Comments
 (0)