File tree Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1691,6 +1691,14 @@ impl ExitCode {
16911691 }
16921692}
16931693
1694+ #[ unstable( feature = "process_exitcode_placeholder" , issue = "48711" ) ]
1695+ impl From < u8 > for ExitCode {
1696+ /// Construct an exit code from an arbitrary u8 value.
1697+ fn from ( code : u8 ) -> Self {
1698+ ExitCode ( imp:: ExitCode :: from ( code) )
1699+ }
1700+ }
1701+
16941702impl Child {
16951703 /// Forces the child process to exit. If the child has already exited, an [`InvalidInput`]
16961704 /// error is returned.
Original file line number Diff line number Diff line change @@ -476,6 +476,12 @@ impl ExitCode {
476476 }
477477}
478478
479+ impl From < u8 > for ExitCode {
480+ fn from ( code : u8 ) -> Self {
481+ Self ( code)
482+ }
483+ }
484+
479485pub struct CommandArgs < ' a > {
480486 iter : crate :: slice:: Iter < ' a , CString > ,
481487}
Original file line number Diff line number Diff line change @@ -162,6 +162,15 @@ impl ExitCode {
162162 }
163163}
164164
165+ impl From < u8 > for ExitCode {
166+ fn from ( code : u8 ) -> Self {
167+ match code {
168+ 0 => Self :: SUCCESS ,
169+ 1 ..255 => Self :: FAILURE ,
170+ }
171+ }
172+ }
173+
165174pub struct Process ( !) ;
166175
167176impl Process {
Original file line number Diff line number Diff line change @@ -666,6 +666,12 @@ impl ExitCode {
666666 }
667667}
668668
669+ impl From < u8 > for ExitCode {
670+ fn from ( code : u8 ) -> Self {
671+ ExitCode ( c:: DWORD :: from ( code) )
672+ }
673+ }
674+
669675fn zeroed_startupinfo ( ) -> c:: STARTUPINFO {
670676 c:: STARTUPINFO {
671677 cb : 0 ,
You can’t perform that action at this time.
0 commit comments