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.
This commit is contained in:
sankalp committed 2026-05-25 14:50:06 +05:45
1 parent 0219f1c8ce
commit 74aa1ff262
1 file changed
+7 -1
+7 -1
View File
@@ -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);