daemonize application

This commit is contained in:
2025-09-28 18:12:01 +03:00
parent 4b3ac42b28
commit 0c492f40eb
3 changed files with 26 additions and 0 deletions

18
Cargo.lock generated
View File

@@ -5,3 +5,21 @@ version = 4
[[package]]
name = "ct"
version = "0.1.0"
dependencies = [
"daemonize",
]
[[package]]
name = "daemonize"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab8bfdaacb3c887a54d41bdf48d3af8873b3f5566469f8ba21b92057509f116e"
dependencies = [
"libc",
]
[[package]]
name = "libc"
version = "0.2.176"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174"

View File

@@ -5,3 +5,4 @@ edition = "2024"
description = "Custom Timer"
[dependencies]
daemonize = "0.5.0"

View File

@@ -6,6 +6,8 @@ use std::{
time::Duration,
};
use daemonize::Daemonize;
fn main() {
let args: Vec<String> = args().collect();
let timeout: u64 = args.get(1)
@@ -28,6 +30,11 @@ fn main() {
path
});
Daemonize::new()
.working_directory(env::current_dir().unwrap())
.start()
.unwrap();
sleep(sleeping_amount);
let mut sound_alert = Command::new("pw-play")