From 826db313f05467e8c458e976cf195d889fd66b50 Mon Sep 17 00:00:00 2001 From: Ethan Hall Date: Wed, 26 Sep 2018 23:31:41 -0700 Subject: [PATCH] Exit on Cont+C & Stop some integ tests from running on windows --- inc-lib/src/exec/executor.rs | 5 +++-- inc/tests/inc-checkout.rs | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/inc-lib/src/exec/executor.rs b/inc-lib/src/exec/executor.rs index 306c2a6..0828954 100644 --- a/inc-lib/src/exec/executor.rs +++ b/inc-lib/src/exec/executor.rs @@ -127,14 +127,14 @@ fn wait_for_output(child: Child) -> Result { #[cfg(unix)] fn wait_for_output(child: Child) -> Result { - use libc::{kill, SIGKILL, SIGTERM}; + use libc::{kill, SIGKILL, SIGINT}; use std::thread::sleep; use std::time::Duration; let child_id = child.id(); let signal = unsafe { match signal_hook::register(signal_hook::SIGINT, move || { - kill(child_id as i32, SIGTERM); + kill(child_id as i32, SIGINT); sleep(Duration::from_millis(100)); for i in (0..50).rev() { let is_dead: i32 = kill(child_id as i32, 0 as i32); @@ -149,6 +149,7 @@ fn wait_for_output(child: Child) -> Result { } warn!("Killing process!"); kill(child_id as i32, SIGKILL); + std::process::exit(1); }) { Ok(sig) => sig, Err(_) => { diff --git a/inc/tests/inc-checkout.rs b/inc/tests/inc-checkout.rs index d638fb7..4d0242e 100644 --- a/inc/tests/inc-checkout.rs +++ b/inc/tests/inc-checkout.rs @@ -26,6 +26,7 @@ mod checkout_integration { } #[test] + #[cfg(unix)] fn checkout_no_args() { create_assert() .with_args(&["checkout"]) @@ -44,6 +45,7 @@ For more information try --help", } #[test] + #[cfg(unix)] fn checkout_help() { create_assert() .with_args(&["checkout", "--help"]) @@ -116,6 +118,7 @@ ARGS: } #[test] + #[cfg(unix)] fn checkout_from_service_with_param() { with_test_dir(|tmp_dir| { let checkout_dir = tmp_dir.clone().join("inc-checkout"); @@ -141,6 +144,7 @@ ARGS: } #[test] + #[cfg(unix)] fn checkout_from_service() { with_test_dir(|tmp_dir| { let file_path = tmp_dir.clone().join("inc-checkout-service-foobar");