summaryrefslogtreecommitdiffstats
path: root/tests/ui/process/signal-exit-status.rs
blob: 9519ed7b4c7b17df58b13db0e10837235d66f21b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// run-pass
// ignore-emscripten no processes
// ignore-sgx no processes
// ignore-windows
// ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#58590)

use std::env;
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();
        assert!(status.code().is_none());
    }
}