summaryrefslogtreecommitdiffstats
path: root/tokio-signal/tests/signal.rs
blob: 05318e415e71b1945c7df984bcc60429a17c5e02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![cfg(unix)]

extern crate libc;

pub mod support;
use support::*;

#[test]
fn tokio_simple() {
    let signal_future = Signal::new(libc::SIGUSR1)
        .and_then(|signal| {
            send_signal(libc::SIGUSR1);
            signal.into_future().map(|_| ()).map_err(|(err, _)| err)
        });

    let mut rt = CurrentThreadRuntime::new()
        .expect("failed to init runtime");
    run_with_timeout(&mut rt, signal_future)
        .expect("failed");
}