Skip to content
This repository has been archived by the owner on Mar 22, 2020. It is now read-only.

Commit

Permalink
Exit on Cont+C & Stop some integ tests from running on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ethankhall committed Sep 27, 2018
1 parent 881f057 commit 826db31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inc-lib/src/exec/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ fn wait_for_output(child: Child) -> Result<Output, std::io::Error> {

#[cfg(unix)]
fn wait_for_output(child: Child) -> Result<Output, std::io::Error> {
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);
Expand All @@ -149,6 +149,7 @@ fn wait_for_output(child: Child) -> Result<Output, std::io::Error> {
}
warn!("Killing process!");
kill(child_id as i32, SIGKILL);
std::process::exit(1);
}) {
Ok(sig) => sig,
Err(_) => {
Expand Down
4 changes: 4 additions & 0 deletions inc/tests/inc-checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod checkout_integration {
}

#[test]
#[cfg(unix)]
fn checkout_no_args() {
create_assert()
.with_args(&["checkout"])
Expand All @@ -44,6 +45,7 @@ For more information try --help",
}

#[test]
#[cfg(unix)]
fn checkout_help() {
create_assert()
.with_args(&["checkout", "--help"])
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit 826db31

Please sign in to comment.