Skip to content

Commit 9e1d138

Browse files
committed
daemon: Respond to Ctrl+C signal gracefully
1 parent a6679dd commit 9e1d138

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

credentialsd/src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ async fn run() -> Result<(), Box<dyn Error>> {
4949
println!(" ✅");
5050

5151
println!("Waiting for messages...");
52-
loop {
53-
// wait forever, handle D-Bus in the background
54-
std::future::pending::<()>().await;
55-
}
52+
tokio::signal::ctrl_c()
53+
.await
54+
.map_err(|err| format!("Failed to wait for shutdown signals: {err}. Shutting down"))?;
55+
56+
Ok(())
5657
}

0 commit comments

Comments
 (0)