Skip to content

Commit e57a0c6

Browse files
committed
sleep: Ignore the SIGALRM signal
1 parent 592f940 commit e57a0c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

datetime/sleep.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use clap::Parser;
1111
use gettextrs::{bind_textdomain_codeset, gettext, setlocale, textdomain, LocaleCategory};
12+
use libc::{signal, SIGALRM, SIG_IGN};
1213
use plib::PROJECT_NAME;
1314
use std::{thread, time};
1415

@@ -30,6 +31,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3031
textdomain(PROJECT_NAME)?;
3132
bind_textdomain_codeset(PROJECT_NAME, "UTF-8")?;
3233

34+
unsafe {
35+
// Ignore the SIGALRM signal
36+
signal(SIGALRM, SIG_IGN);
37+
}
38+
3339
thread::sleep(time::Duration::from_secs(args.seconds));
3440

3541
Ok(())

0 commit comments

Comments
 (0)