diff --git a/src/main.rs b/src/main.rs index 996dfdd..3be1819 100644 --- a/src/main.rs +++ b/src/main.rs @@ -224,30 +224,28 @@ fn get_settings() -> Settings { } #[cfg(target_os = "linux")] -#[tokio::main] -async fn main() { +fn main() { let current_directory = env::current_dir().expect("Could not get app directory."); let stdout = File::create("/var/vote/log/daemon.out").unwrap(); let stderr = File::create("/var/vote/log/daemon.err").unwrap(); let daemonize = Daemonize::new() .pid_file("/var/vote/server.pid") - .chown_pid_file(true) .working_directory(current_directory) .stdout(stdout) .stderr(stderr); match daemonize.start() { - Ok(_) => run().await, + Ok(_) => run(), Err(e) => eprintln!("Error, {}", e), } } #[cfg(target_os = "windows")] -#[tokio::main] -async fn main() { - run().await; +fn main() { + run(); } +#[tokio::main] async fn run() { let settings = get_settings(); let db_pool = Arc::new(Mutex::new(SqlitePool::connect(&settings.database_url).await.expect("Could not connect to database. Make sure the url is correct.")));