]>
Commit | Line | Data |
---|---|---|
a7813a04 XL |
1 | // Copyright 2016 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 | // compile-flags:-C panic=abort | |
12 | // no-prefer-dynamic | |
2c00a5a8 | 13 | // ignore-cloudabi no processes |
abe05a73 | 14 | // ignore-emscripten no processes |
a7813a04 XL |
15 | |
16 | use std::process::Command; | |
17 | use std::env; | |
18 | ||
19 | struct Bomb; | |
20 | ||
21 | impl Drop for Bomb { | |
22 | fn drop(&mut self) { | |
23 | std::process::exit(0); | |
24 | } | |
25 | } | |
26 | ||
27 | fn main() { | |
28 | let mut args = env::args_os(); | |
29 | let me = args.next().unwrap(); | |
30 | ||
31 | if let Some(s) = args.next() { | |
32 | if &*s == "foo" { | |
33 | ||
34 | let _bomb = Bomb; | |
35 | ||
36 | panic!("try to catch me"); | |
37 | } | |
38 | } | |
7cac9316 XL |
39 | |
40 | let mut cmd = Command::new(env::args_os().next().unwrap()); | |
41 | cmd.arg("foo"); | |
42 | ||
43 | // ARMv6 hanges while printing the backtrace, see #41004 | |
44 | if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") { | |
45 | cmd.env("RUST_BACKTRACE", "0"); | |
46 | } | |
47 | ||
48 | let s = cmd.status(); | |
a7813a04 XL |
49 | assert!(s.unwrap().code() != Some(0)); |
50 | } |