-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ExitStatusExt::aborted_code for Fuchsia platform
- Loading branch information
Showing
7 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! Fuchsia-specific extensions to primitives in the [`std::process`] module. | ||
//! | ||
//! [`std::process`]: crate::process | ||
|
||
use crate::process; | ||
use crate::sealed::Sealed; | ||
|
||
#[unstable(feature = "fuchsia_exit_status_aborted", issue = "none")] | ||
pub trait ExitStatusExt: Sealed { | ||
/// If the process was aborted, returns the status code. | ||
#[must_use] | ||
fn aborted_code(&self) -> Option<i32>; | ||
} | ||
|
||
#[unstable(feature = "fuchsia_exit_status_aborted", issue = "none")] | ||
impl ExitStatusExt for process::ExitStatus { | ||
/// If the process was aborted, returns the status code. | ||
fn aborted_code(&self) -> Option<i32> { | ||
match self.code() { | ||
// Upon an abort, Fuchsia returns the status code ZX_TASK_RETCODE_EXCEPTION_KILL. | ||
code @ Some(-1028) => code, | ||
Some(_) | None => None, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters