diff options
author | Ondřej Čertík <ondrej@certik.us> | 2020-01-15 23:19:20 -0700 |
---|---|---|
committer | Ondřej Čertík <ondrej@certik.us> | 2020-01-15 23:19:20 -0700 |
commit | fe55ad285512afb2ce59d5b3bcb0aa56effc798a (patch) | |
tree | ccdfa9ae8746350628022dd91c5d4912d346e30e /tests/cli.rs | |
parent | 1f7bf6c0335a6979e11a62fc07cd8cb7c1c04464 (diff) | |
download | fpm-fe55ad285512afb2ce59d5b3bcb0aa56effc798a.tar.gz fpm-fe55ad285512afb2ce59d5b3bcb0aa56effc798a.zip |
Let it compile on Windows
Diffstat (limited to 'tests/cli.rs')
-rw-r--r-- | tests/cli.rs | 13 |
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); } } |