diff options
author | Ondřej Čertík <ondrej@certik.us> | 2020-01-15 22:55:04 -0700 |
---|---|---|
committer | Ondřej Čertík <ondrej@certik.us> | 2020-01-15 23:06:06 -0700 |
commit | 710a9fa4da4f208462d51b594e27c588e4b39f61 (patch) | |
tree | e8221f5c1b0e85111ef65e4e128acdcf8adc74c0 | |
parent | 7b53dd48556cf792359c030fcdb01693e1db45b4 (diff) | |
download | fpm-710a9fa4da4f208462d51b594e27c588e4b39f61.tar.gz fpm-710a9fa4da4f208462d51b594e27c588e4b39f61.zip |
Extract the signal and report it
-rw-r--r-- | tests/cli.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/cli.rs b/tests/cli.rs index ebdcd24..d980853 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -2,13 +2,17 @@ use std::process::Command; // Run programs use assert_cmd::prelude::*; // Add methods on commands use predicates::prelude::*; // Used for writing assertions use assert_cmd::assert::Assert; +use std::os::unix::process::ExitStatusExt; // Our own function, so that we can better debug the failure fn success(self0: Assert) -> Assert { if !self0.get_output().status.success() { - let actual_code = self0.get_output().status.code().unwrap_or_else(|| { - panic!("INTERRUPTED") - }); + let code = self0.get_output().status.code(); + if code.is_none() { + let signal = self0.get_output().status.signal().unwrap(); + panic!("INTERRUPTED with signal: {}", signal); + } + let actual_code = code.unwrap(); panic!("Non zero exit code: {}", actual_code); } self0 |