]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/weird-exit-code.rs
Auto merge of #61361 - estebank:infer-type, r=varkor
[rust.git] / src / test / run-pass / weird-exit-code.rs
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
10 #[cfg(windows)]
11 fn main() {
12     use std::process::{self, Command};
13     use std::env;
14
15     if env::args().len() == 1 {
16         let status = Command::new(env::current_exe().unwrap())
17                              .arg("foo")
18                              .status()
19                              .unwrap();
20         assert_eq!(status.code(), Some(259));
21     } else {
22         process::exit(259);
23     }
24 }
25
26 #[cfg(not(windows))]
27 fn main() {}