From 74aa1ff2623ae07e5ba7735b0152c8b072f94eb5 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Mon, 25 May 2026 14:50:06 +0545 Subject: [PATCH] fix(src): handle tokio runtime creation errors gracefullyBug Fixes: - Added proper error handling for tokio runtime creation, exiting with a clear error message instead of panicking. --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b5d370a..7033274 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,13 @@ fn main() { Commands::InstallRules => commands::install_rules::execute(), Commands::Touchpad { command } => commands::touchpad::execute(command), Commands::Daemon => { - let rt = tokio::runtime::Runtime::new().unwrap(); + let rt = match tokio::runtime::Runtime::new() { + Ok(rt) => rt, + Err(e) => { + eprintln!("Failed to create tokio runtime: {}", e); + std::process::exit(1); + } + }; rt.block_on(async { if let Err(e) = lapctl::daemon::run().await { eprintln!("Daemon error: {}", e);