diff options
Diffstat (limited to 'tests/ui/process/signal-exit-status.rs')
-rw-r--r-- | tests/ui/process/signal-exit-status.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/process/signal-exit-status.rs b/tests/ui/process/signal-exit-status.rs new file mode 100644 index 000000000..9519ed7b4 --- /dev/null +++ b/tests/ui/process/signal-exit-status.rs @@ -0,0 +1,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()); + } +} |