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.

20 lines
543 B
Rust
Raw Normal View History

// run-pass
// ignore-emscripten 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)
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" {
// Raise a segfault.
unsafe { *(1 as *mut isize) = 0; }
} else {
let status = Command::new(&args[0]).arg("signal").status().unwrap();
2015-04-10 18:12:43 +00:00
assert!(status.code().is_none());
}
}