agatan / signal-notify

Catch system signals by mpsc channel in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

signal-notify crate provides a simple way to wait for signals in *nix systems through standard std::sync::mpsc API.

Build Status

use signal_notify::{notify, Signal};

let rx = notify(&[Signal::INT, Signal::HUP]);
// block unitl receiving SIGINT or SIGHUP.
// recv always return Ok because the sender channel will be never closed.
rx.recv().unwrap()

signal-notify doesn't support Windows. I'm not familiar with Windows, so I'd be happy if you could help me about it.

About

Catch system signals by mpsc channel in Rust

License:MIT License


Languages

Language:Rust 100.0%