From fe55ad285512afb2ce59d5b3bcb0aa56effc798a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Wed, 15 Jan 2020 23:19:20 -0700 Subject: Let it compile on Windows --- tests/cli.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/cli.rs') 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 { + status.signal() +} + +#[cfg(not(unix))] +fn get_signal(status: ExitStatus) -> Option { + 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); } } -- cgit v1.2.3