Skip to content

Commit

Permalink
Ignore SIGHUP
Browse files Browse the repository at this point in the history
nohup will not work if SIGHUP is handled
  • Loading branch information
contrun committed Jan 17, 2025
1 parent 8725983 commit 5d951a6
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,10 @@ async fn signal_listener() {
let mut sigterm = signal(SignalKind::terminate()).expect("listen for SIGTERM");
// SIGINT is usually sent due to ctrl-c in the terminal.
let mut sigint = signal(SignalKind::interrupt()).expect("listen for SIGINT");
// SIGHUP is usually sent when the terminal closes or the user logs out (for instance logs out of an SSH session).
let mut sighup = signal(SignalKind::hangup()).expect("listen for SIGHUP");

tokio::select! {
_ = sigterm.recv() => info!("SIGTERM received, shutting down"),
_ = sigint.recv() => info!("SIGINT received, shutting down"),
_ = sighup.recv() => info!("SIGHUP received, shutting down"),
};
}

Expand Down

0 comments on commit 5d951a6

Please sign in to comment.