Skip to content

Commit d08fb12

Browse files
committed
weird-exit-code
1 parent 10951bb commit d08fb12

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

tests/ui/process/windows-exit-code-still-active.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
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)]
1213
fn 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);

0 commit comments

Comments
 (0)