Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,10 @@ pub async fn run(
Ok(())
}

pub fn spawn(config: app_config::Config) {
pub fn spawn(config: app_config::Config) -> Result<(), std::io::Error> {
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap_or_else(|e| panic!("Failed to create Tokio runtime: {e}"));
if let Err(e) = runtime.block_on(run(config, runtime.handle().clone())) {
error!("Daemon failed: {e}");
panic!("Daemon failed: {e}");
}
runtime.block_on(run(config, runtime.handle().clone()))
}
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ fn main() {
match daemonize.start() {
Ok(()) => {
trc_handle.reconfigure_for_daemon();
daemon::spawn(config);
if let Err(e) = daemon::spawn(config) {
error!("Daemon failed: {e}");
std::process::exit(1);
}
}
Err(e) => {
error!("Failed to spawn the daemon: {e}");
}
}
} else {
daemon::spawn(config);
} else if let Err(e) = daemon::spawn(config) {
error!("Daemon failed: {e}");
std::process::exit(1);
}
}
Command::Reload => {}
Expand Down