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
+
1
10
//@ 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).
10
11
11
12
#[ cfg( windows) ]
12
13
fn main ( ) {
13
- use std:: process:: { self , Command } ;
14
14
use std:: env;
15
+ use std:: process:: { self , Command } ;
15
16
16
17
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 ( ) ;
21
19
assert_eq ! ( status. code( ) , Some ( 259 ) ) ;
22
20
} else {
23
21
process:: exit ( 259 ) ;
You can’t perform that action at this time.
0 commit comments