1 unstable release

0.1.0 Apr 12, 2021

#838 in Unix APIs

42 downloads per month
Used in 3 crates (via cotton)

MIT license

6KB

Latest Version Documentation License

Guard type that keeps selected Unix signals suppressed.

use uninterruptible::Uninterruptible;

// catch terminate signals (SIGTERM, SIGQUIT, SIGINT)
let u = Uninterruptible::terminate()?;

// do work, e.g. call in sub-process

u.checkpoint()?; // fails if the process recived one of the terminate signals (e.g. CTRL-C was pressed)


drop(u); // revert to default signal handlers

See module level documentation on docs.rs for more examples.


lib.rs:

Guard type that keeps selected Unix signals suppressed.

use uninterruptible::Uninterruptible;

// catch terminate signals (SIGTERM, SIGQUIT, SIGINT)
let u = Uninterruptible::terminate().unwrap();

// do work, e.g. call in sub-process

u.checkpoint().unwrap(); // fails if the process recived one of the terminate signals (e.g. CTRL-C was pressed)


drop(u); // revert to default signal handlers

Dependencies

~200KB