From 710a9fa4da4f208462d51b594e27c588e4b39f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 15 Jan 2020 22:55:04 -0700 Subject: Extract the signal and report it --- tests/cli.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/cli.rs') 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 -- cgit v1.2.3