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:
Ferdinand Schober
2023-02-18 04:03:10 +01:00
committed by GitHub
parent deb1548e21
commit a2d2e904f8
9 changed files with 205 additions and 83 deletions

View File

@@ -1,6 +1,6 @@
#[cfg(unix)]
use std::env;
use std::{thread::{JoinHandle, self}, sync::mpsc::SyncSender};
use std::{thread::{JoinHandle, self}, sync::mpsc::SyncSender, error::Error};
use crate::{client::{Client, ClientHandle}, event::Event, request::Server};
@@ -16,8 +16,8 @@ pub fn start(
produce_tx: SyncSender<(Event, ClientHandle)>,
clients: Vec<Client>,
request_server: Server,
) -> JoinHandle<()> {
thread::Builder::new()
) -> Result<JoinHandle<()>, Box<dyn Error>> {
Ok(thread::Builder::new()
.name("event producer".into())
.spawn(move || {
#[cfg(windows)]
@@ -48,6 +48,5 @@ pub fn start(
producer::wayland::run(produce_tx, request_server, clients);
}
}
})
.unwrap()
})?)
}