try_set_handler

Function try_set_handler 

Source
pub fn try_set_handler<F>(user_handler: F) -> Result<JoinHandle<()>, Error>
where F: FnMut() -> bool + 'static + Send,
Expand description

The same as ctrlc2::set_handler but errors if a handler already exists for the signal(s).

The user_handler function is customizable and the return boolean value is indicating whether the user agreed terminate the program or not.

ยงErrors

Will return an error if another handler exists or if a system error occurred while setting the handler.