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:
1 file changed
+7
-1
+7
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user