rust/tests/ui/process/signal-exit-status.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
584 B
Rust
Raw Normal View History

//@ run-pass
//@ ignore-wasm32 no processes
2019-04-24 16:26:33 +00:00
//@ ignore-sgx no processes
//@ ignore-windows
//@ ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#58590)
2023-03-29 01:37:15 +00:00
#![feature(core_intrinsics)]
use std::env;
2015-04-10 18:12:43 +00:00
use std::process::Command;
pub fn main() {
let args: Vec<String> = env::args().collect();
if args.len() >= 2 && args[1] == "signal" {
2023-03-29 01:37:15 +00:00
// Raise an aborting signal without UB
core::intrinsics::abort();
} else {
let status = Command::new(&args[0]).arg("signal").status().unwrap();
2015-04-10 18:12:43 +00:00
assert!(status.code().is_none());
}
}