Only daemonize on cfg(unix) platforms

This commit is contained in:
Jeremy Soller 2023-11-28 12:03:30 -07:00
parent 0e8fd4eb8c
commit 7b76437224
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
2 changed files with 4 additions and 1 deletions

View file

@ -7,7 +7,6 @@ license = "GPL-3.0-only"
[dependencies] [dependencies]
env_logger = "0.10.0" env_logger = "0.10.0"
fork = "0.1"
lazy_static = "1.4.0" lazy_static = "1.4.0"
log = "0.4.20" log = "0.4.20"
notify = "6.1.1" notify = "6.1.1"
@ -38,6 +37,9 @@ features = ["tokio", "winit", "wgpu"]
[dependencies.systemicons] [dependencies.systemicons]
git = "https://github.com/jackpot51/systemicons" git = "https://github.com/jackpot51/systemicons"
[target.'cfg(unix)'.dependencies]
fork = "0.1"
[features] [features]
default = ["rfd"] default = ["rfd"]

View file

@ -60,6 +60,7 @@ lazy_static::lazy_static! {
} }
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(unix)]
match fork::daemon(true, true) { match fork::daemon(true, true) {
Ok(fork::Fork::Child) => (), Ok(fork::Fork::Child) => (),
Ok(fork::Fork::Parent(_child_pid)) => process::exit(0), Ok(fork::Fork::Parent(_child_pid)) => process::exit(0),