diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-07-11 07:35:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-11 07:35:19 +0200 |
| commit | 66799d0b83df8ef34df210ba454b59fce53fd1e9 (patch) | |
| tree | 4d5703b8d224e0d654c41b81edd9eb7fed76be7d /tests/ui/process/windows-exit-code-still-active.rs | |
| parent | 3d6eb225e26448b09fdec1ba7222f3e7174c6ac2 (diff) | |
| parent | 259512e3b6a920b1e1eb6034fbc738e7b9815337 (diff) | |
| download | rust-66799d0b83df8ef34df210ba454b59fce53fd1e9.tar.gz rust-66799d0b83df8ef34df210ba454b59fce53fd1e9.zip | |
Rollup merge of #143303 - Kivooeo:tf28, r=tgross35
`tests/ui`: A New Order [28/28] FINAL PART > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? ``@tgross35``
Diffstat (limited to 'tests/ui/process/windows-exit-code-still-active.rs')
| -rw-r--r-- | tests/ui/process/windows-exit-code-still-active.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/process/windows-exit-code-still-active.rs b/tests/ui/process/windows-exit-code-still-active.rs new file mode 100644 index 00000000000..e661a4f6adc --- /dev/null +++ b/tests/ui/process/windows-exit-code-still-active.rs @@ -0,0 +1,26 @@ +//! On Windows the GetExitCodeProcess API is used to get the exit code of a +//! process, but it's easy to mistake a process exiting with the code 259 as +//! "still running" because this is the value of the STILL_ACTIVE constant. Make +//! sure we handle this case in the standard library and correctly report the +//! status. +//! +//! Note that this is disabled on unix as processes exiting with 259 will have +//! their exit status truncated to 3 (only the lower 8 bits are used). + +//@ run-pass + +#[cfg(windows)] +fn main() { + use std::env; + use std::process::{self, Command}; + + if env::args().len() == 1 { + let status = Command::new(env::current_exe().unwrap()).arg("foo").status().unwrap(); + assert_eq!(status.code(), Some(259)); + } else { + process::exit(259); + } +} + +#[cfg(not(windows))] +fn main() {} |
