From ccd87ae70ca2a7a65a10676b996a0806c0b1375f Mon Sep 17 00:00:00 2001 From: "nieznany.sprawiciel" Date: Thu, 11 Apr 2024 19:01:19 +0200 Subject: [PATCH] Fix handling termination; Finish all tasks --- src/main.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 891d805..417fb77 100644 --- a/src/main.rs +++ b/src/main.rs @@ -175,10 +175,14 @@ async fn try_main() -> anyhow::Result<()> { let (signal_sender, signal_receiver) = mpsc::channel::(1); - select! { - res = handle_cli(cli, signal_receiver) => res, - res = handle_signals(signal_sender) => res, - } + tokio::task::spawn_local(async move { + handle_signals(signal_sender) + .await + .inspect_err(|e| log::error!("Error waiting for signal: {e}")) + .ok(); + }); + + handle_cli(cli, signal_receiver).await } async fn handle_cli(cli: Cli, signal_receiver: Receiver) -> anyhow::Result<()> {