diff --git a/Cargo.toml b/Cargo.toml index a89c19e1f..5dbb90038 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,4 +26,4 @@ mio-named-pipes = "0.1" [target.'cfg(unix)'.dependencies] libc = "0.2" -tokio-signal = "0.1" +tokio-signal = "0.1.2" diff --git a/src/lib.rs b/src/lib.rs index 0f7f825c5..954d7eb46 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,16 +79,6 @@ //! future of the child's `ExitStatus`, a child process is terminated if //! `tokio_process::Child` is dropped. The behavior of the standard library can //! be regained with the `Child::forget` method. -//! -//! As a final caveat, currently this crate relies on the `tokio-signal` crate -//! and therefore inherits its current restriction. Namely, once a child has -//! been spawned onto an event loop then *that event loop must stay alive for -//! any spawned child in the future to make progress*. In other words, once -//! you spawn a child onto an event loop, you should ensure that the event loop -//! keeps running for the duration of the program if there are multiple event -//! loops. Unfortunately this makes testing particularly tricky, but you can -//! work around this with an initial event loop that just runs forever in the -//! background. #![deny(missing_docs)] diff --git a/tests/smoke.rs b/tests/smoke.rs index a914e6c7f..89f3e300b 100644 --- a/tests/smoke.rs +++ b/tests/smoke.rs @@ -8,8 +8,6 @@ mod support; #[test] fn simple() { - support::init(); - let mut lp = Core::new().unwrap(); let mut cmd = support::cmd("exit"); cmd.arg("2"); diff --git a/tests/stdio.rs b/tests/stdio.rs index 1235072c6..a09426453 100644 --- a/tests/stdio.rs +++ b/tests/stdio.rs @@ -83,8 +83,6 @@ fn feed_cat(mut cat: Child, n: usize) -> BoxFuture { /// /// - The child does produce EOF on stdout after the last line. fn feed_a_lot() { - support::init(); - let mut lp = Core::new().unwrap(); let child = cat().spawn_async(&lp.handle()).unwrap(); let status = lp.run(feed_cat(child, 10000)).unwrap(); @@ -93,8 +91,6 @@ fn feed_a_lot() { #[test] fn drop_kills() { - support::init(); - let mut lp = Core::new().unwrap(); let mut child = cat().spawn_async(&lp.handle()).unwrap(); let stdin = child.stdin().take().unwrap(); @@ -108,8 +104,6 @@ fn drop_kills() { #[test] fn wait_with_output_captures() { - support::init(); - let mut core = Core::new().unwrap(); let mut child = cat().spawn_async(&core.handle()).unwrap(); diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 79f213d1c..878afb12a 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -5,32 +5,6 @@ extern crate tokio_process; use std::env; use std::process::Command; -use std::sync::{Once, ONCE_INIT}; -use std::thread; -use std::sync::mpsc::channel; - -use self::tokio_core::reactor::Core; -use self::futures::future; -use self::tokio_process::CommandExt; - -pub fn init() { - static INIT: Once = ONCE_INIT; - - INIT.call_once(|| { - drop(env_logger::init()); - let (tx, rx) = channel(); - thread::spawn(move || { - let mut lp = Core::new().unwrap(); - let mut cmd = cmd("exit"); - let mut child = cmd.spawn_async(&lp.handle()).unwrap(); - drop(child.kill()); - lp.run(child).unwrap(); - tx.send(()).unwrap(); - drop(lp.run(future::empty::<(), ()>())); - }); - rx.recv().unwrap(); - }); -} pub fn cmd(s: &str) -> Command { let mut me = env::current_exe().unwrap();