mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-25 13:24:22 +00:00
unix ExitStatus: Provide .core_dumped
This is essential for proper reporting of child process status on Unix. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
parent
530270f94a
commit
3f05051d6b
@ -176,6 +176,10 @@ pub trait ExitStatusExt {
|
|||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
fn signal(&self) -> Option<i32>;
|
fn signal(&self) -> Option<i32>;
|
||||||
|
|
||||||
|
/// If the process was terminated by a signal, says whether it dumped core.
|
||||||
|
#[unstable(feature = "unix_process_wait_more", issue = "none")]
|
||||||
|
fn core_dumped(&self) -> bool;
|
||||||
|
|
||||||
/// Returns the underlying raw `wait` status.
|
/// Returns the underlying raw `wait` status.
|
||||||
#[unstable(feature = "unix_process_wait_more", issue = "none")]
|
#[unstable(feature = "unix_process_wait_more", issue = "none")]
|
||||||
fn into_raw(self) -> i32;
|
fn into_raw(self) -> i32;
|
||||||
@ -191,6 +195,10 @@ impl ExitStatusExt for process::ExitStatus {
|
|||||||
self.as_inner().signal()
|
self.as_inner().signal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn core_dumped(&self) -> bool {
|
||||||
|
self.as_inner().core_dumped()
|
||||||
|
}
|
||||||
|
|
||||||
fn into_raw(self) -> i32 {
|
fn into_raw(self) -> i32 {
|
||||||
self.as_inner().into_raw().into()
|
self.as_inner().into_raw().into()
|
||||||
}
|
}
|
||||||
|
@ -482,6 +482,10 @@ impl ExitStatus {
|
|||||||
if libc::WIFSIGNALED(self.0) { Some(libc::WTERMSIG(self.0)) } else { None }
|
if libc::WIFSIGNALED(self.0) { Some(libc::WTERMSIG(self.0)) } else { None }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn core_dumped(&self) -> bool {
|
||||||
|
libc::WIFSIGNALED(self.0) && libc::WCOREDUMP(self.0)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn into_raw(&self) -> c_int {
|
pub fn into_raw(&self) -> c_int {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user