]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/signal-exit-status.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / test / run-pass / signal-exit-status.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
11// ignore-windows
abe05a73 12// ignore-emscripten no processes
1a4d82fc 13
85aaf69f 14use std::env;
9346a6ac 15use std::process::Command;
1a4d82fc
JJ
16
17pub fn main() {
85aaf69f
SL
18 let args: Vec<String> = env::args().collect();
19 if args.len() >= 2 && args[1] == "signal" {
1a4d82fc 20 // Raise a segfault.
9e0c209e 21 unsafe { *(1 as *mut isize) = 0; }
1a4d82fc 22 } else {
85aaf69f 23 let status = Command::new(&args[0]).arg("signal").status().unwrap();
9346a6ac 24 assert!(status.code().is_none());
1a4d82fc
JJ
25 }
26}