From 1f7bf6c0335a6979e11a62fc07cd8cb7c1c04464 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:07:59 -0700 Subject: Only import std::os::unix on Unix --- tests/cli.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/cli.rs') diff --git a/tests/cli.rs b/tests/cli.rs index fb73e8a..40fabbd 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -2,6 +2,7 @@ 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; +#[cfg(unix)] use std::os::unix::process::ExitStatusExt; pub trait Success2 { @@ -13,9 +14,11 @@ impl Success2 for Assert { fn success2(self) -> Self { if !self.get_output().status.success() { let code = self.get_output().status.code(); - if code.is_none() { - let signal = self.get_output().status.signal().unwrap(); - panic!("INTERRUPTED with signal: {}", signal); + if cfg!(unix) { + if code.is_none() { + let signal = self.get_output().status.signal().unwrap(); + panic!("INTERRUPTED with signal: {}", signal); + } } let actual_code = code.unwrap(); panic!("Non zero exit code: {}", actual_code); -- cgit v1.2.3