daemon: Fix shutting down on getting SIGTERM

This commit is contained in:
Vicki Pfau 2025-01-24 18:26:22 -08:00
parent 79716db2e0
commit 7b0fa3911d

View file

@ -132,10 +132,16 @@ impl<C: DaemonContext> Daemon<C> {
Ok(Err(e)) => Err(e),
Err(e) => Err(e.into())
},
_ = tokio::signal::ctrl_c() => break Ok(()),
_ = tokio::signal::ctrl_c() => {
info!("Got SIGINT, shutting down");
break Ok(());
}
e = sigterm.recv() => match e {
Some(()) => Ok(()),
None => Err(anyhow!("SIGTERM machine broke")),
Some(()) => {
info!("Got SIGTERM, shutting down");
break Ok(());
}
None => Err(anyhow!("SIGTERM pipe broke")),
},
e = sighup.recv() => match e {
Some(()) => {
@ -148,7 +154,7 @@ impl<C: DaemonContext> Daemon<C> {
}
}
}
None => Err(anyhow!("SIGHUP machine broke")),
None => Err(anyhow!("SIGHUP pipe broke")),
},
msg = self.channel.recv() => match msg {
Some(msg) => {