aboutsummaryrefslogtreecommitdiff
path: root/tests/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cli.rs')
-rw-r--r--tests/cli.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/cli.rs b/tests/cli.rs
index 40fabbd..33e63cd 100644
--- a/tests/cli.rs
+++ b/tests/cli.rs
@@ -4,19 +4,30 @@ use predicates::prelude::*; // Used for writing assertions
use assert_cmd::assert::Assert;
#[cfg(unix)]
use std::os::unix::process::ExitStatusExt;
+use std::process::ExitStatus;
pub trait Success2 {
// Our own function with better reporting of errors
fn success2(self) -> Self;
}
+#[cfg(unix)]
+fn get_signal(status: ExitStatus) -> Option<i32> {
+ status.signal()
+}
+
+#[cfg(not(unix))]
+fn get_signal(status: ExitStatus) -> Option<i32> {
+ None
+}
+
impl Success2 for Assert {
fn success2(self) -> Self {
if !self.get_output().status.success() {
let code = self.get_output().status.code();
if cfg!(unix) {
if code.is_none() {
- let signal = self.get_output().status.signal().unwrap();
+ let signal = get_signal(self.get_output().status).unwrap();
panic!("INTERRUPTED with signal: {}", signal);
}
}