mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-23 13:10:56 +03:00
support for cmdline args and better error handling (#4)
* support for cmdline args and better error handling * make config.toml optional * dont abuse panic for error handling * update doc * more panics removed * more unwraps removed
This commit is contained in:
committed by
GitHub
parent
deb1548e21
commit
a2d2e904f8
@@ -1,4 +1,4 @@
|
||||
use std::{thread::{JoinHandle, self}, sync::mpsc::Receiver};
|
||||
use std::{thread::{JoinHandle, self}, sync::mpsc::Receiver, error::Error};
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::env;
|
||||
@@ -14,11 +14,11 @@ enum Backend {
|
||||
Libei,
|
||||
}
|
||||
|
||||
pub fn start(consume_rx: Receiver<(Event, ClientHandle)>, clients: Vec<Client>, backend: Option<String>) -> JoinHandle<()> {
|
||||
pub fn start(consume_rx: Receiver<(Event, ClientHandle)>, clients: Vec<Client>, backend: Option<String>) -> Result<JoinHandle<()>, Box<dyn Error>> {
|
||||
#[cfg(windows)]
|
||||
let _backend = backend;
|
||||
|
||||
thread::Builder::new()
|
||||
Ok(thread::Builder::new()
|
||||
.name("event consumer".into())
|
||||
.spawn(move || {
|
||||
#[cfg(windows)]
|
||||
@@ -72,6 +72,5 @@ pub fn start(consume_rx: Receiver<(Event, ClientHandle)>, clients: Vec<Client>,
|
||||
consumer::x11::run(consume_rx, clients);
|
||||
},
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
})?)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user