File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change 1+ //! On Windows the GetExitCodeProcess API is used to get the exit code of a
2+ //! process, but it's easy to mistake a process exiting with the code 259 as
3+ //! "still running" because this is the value of the STILL_ACTIVE constant. Make
4+ //! sure we handle this case in the standard library and correctly report the
5+ //! status.
6+ //!
7+ //! Note that this is disabled on unix as processes exiting with 259 will have
8+ //! their exit status truncated to 3 (only the lower 8 bits are used).
9+
110//@ run-pass
2- // On Windows the GetExitCodeProcess API is used to get the exit code of a
3- // process, but it's easy to mistake a process exiting with the code 259 as
4- // "still running" because this is the value of the STILL_ACTIVE constant. Make
5- // sure we handle this case in the standard library and correctly report the
6- // status.
7- //
8- // Note that this is disabled on unix as processes exiting with 259 will have
9- // their exit status truncated to 3 (only the lower 8 bits are used).
1011
1112#[ cfg( windows) ]
1213fn main ( ) {
13- use std:: process:: { self , Command } ;
1414 use std:: env;
15+ use std:: process:: { self , Command } ;
1516
1617 if env:: args ( ) . len ( ) == 1 {
17- let status = Command :: new ( env:: current_exe ( ) . unwrap ( ) )
18- . arg ( "foo" )
19- . status ( )
20- . unwrap ( ) ;
18+ let status = Command :: new ( env:: current_exe ( ) . unwrap ( ) ) . arg ( "foo" ) . status ( ) . unwrap ( ) ;
2119 assert_eq ! ( status. code( ) , Some ( 259 ) ) ;
2220 } else {
2321 process:: exit ( 259 ) ;
You can’t perform that action at this time.
0 commit comments