Add From<u8> for ExitCode
This should cover a mostly cross-platform subset of supported exit codes.
This commit is contained in:
parent
f624427f87
commit
cf4ac6b1e1
@ -1691,6 +1691,14 @@ impl ExitCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[unstable(feature = "process_exitcode_placeholder", issue = "48711")]
|
||||||
|
impl From<u8> for ExitCode {
|
||||||
|
/// Construct an exit code from an arbitrary u8 value.
|
||||||
|
fn from(code: u8) -> Self {
|
||||||
|
ExitCode(imp::ExitCode::from(code))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Child {
|
impl Child {
|
||||||
/// Forces the child process to exit. If the child has already exited, an [`InvalidInput`]
|
/// Forces the child process to exit. If the child has already exited, an [`InvalidInput`]
|
||||||
/// error is returned.
|
/// error is returned.
|
||||||
|
@ -476,6 +476,12 @@ impl ExitCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<u8> for ExitCode {
|
||||||
|
fn from(code: u8) -> Self {
|
||||||
|
Self(code)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct CommandArgs<'a> {
|
pub struct CommandArgs<'a> {
|
||||||
iter: crate::slice::Iter<'a, CString>,
|
iter: crate::slice::Iter<'a, CString>,
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,15 @@ impl ExitCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<u8> for ExitCode {
|
||||||
|
fn from(code: u8) -> Self {
|
||||||
|
match code {
|
||||||
|
0 => Self::SUCCESS,
|
||||||
|
1..255 => Self::FAILURE,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Process(!);
|
pub struct Process(!);
|
||||||
|
|
||||||
impl Process {
|
impl Process {
|
||||||
|
@ -666,6 +666,12 @@ impl ExitCode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<u8> for ExitCode {
|
||||||
|
fn from(code: u8) -> Self {
|
||||||
|
ExitCode(c::DWORD::from(code))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn zeroed_startupinfo() -> c::STARTUPINFO {
|
fn zeroed_startupinfo() -> c::STARTUPINFO {
|
||||||
c::STARTUPINFO {
|
c::STARTUPINFO {
|
||||||
cb: 0,
|
cb: 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user