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.
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.
14 use std::io::process::{Command, ExitSignal, ExitStatus};
17 let args = os::args();
18 let args = args.as_slice();
19 if args.len() >= 2 && args[1].as_slice() == "signal" {
21 unsafe { *(0 as *mut int) = 0; }
23 let status = Command::new(args[0].as_slice()).arg("signal").status().unwrap();
24 // Windows does not have signal, so we get exit status 0xC0000028 (STATUS_BAD_STACK).
26 ExitSignal(_) if cfg!(unix) => {},
27 ExitStatus(0xC0000028) if cfg!(windows) => {},
28 _ => panic!("invalid termination (was not signalled): {}", status)