From 2c059d500977f31d738aab67f27cbe4d86aa5d32 Mon Sep 17 00:00:00 2001 From: driftluo Date: Thu, 25 Sep 2025 14:05:18 +0800 Subject: [PATCH] chore: change daemon dependence --- Cargo.lock | 10 ++++++---- ckb-bin/Cargo.toml | 2 +- ckb-bin/src/lib.rs | 7 ++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b31a38cb7..1ef59cb13a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -800,7 +800,7 @@ dependencies = [ "clap", "colored", "ctrlc", - "daemonize", + "daemonize-me", "fdlimit", "is-terminal", "nix", @@ -2400,12 +2400,14 @@ dependencies = [ ] [[package]] -name = "daemonize" -version = "0.5.0" +name = "daemonize-me" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8bfdaacb3c887a54d41bdf48d3af8873b3f5566469f8ba21b92057509f116e" +checksum = "5d7e7dc0363f9af1531fb2d20d257551c971d2da608d37b785901163ca20985f" dependencies = [ "libc", + "nix", + "thiserror 2.0.12", ] [[package]] diff --git a/ckb-bin/Cargo.toml b/ckb-bin/Cargo.toml index f376d7b9cc..8b6286786c 100644 --- a/ckb-bin/Cargo.toml +++ b/ckb-bin/Cargo.toml @@ -49,7 +49,7 @@ ckb-stop-handler.workspace = true tokio = { workspace = true, features = ["sync"] } [target.'cfg(not(target_os="windows"))'.dependencies] -daemonize = { version = "0.5.0" } +daemonize-me = { version = "2" } nix = { version = "0.29.0", default-features = false, features = ["signal"] } colored = "2.0" diff --git a/ckb-bin/src/lib.rs b/ckb-bin/src/lib.rs index 5f8f9972c9..3078bf7b36 100644 --- a/ckb-bin/src/lib.rs +++ b/ckb-bin/src/lib.rs @@ -22,7 +22,7 @@ use setup_guard::SetupGuard; #[cfg(not(target_os = "windows"))] use colored::Colorize; #[cfg(not(target_os = "windows"))] -use daemonize::Daemonize; +use daemonize_me::Daemon; #[cfg(not(target_os = "windows"))] use subcommand::check_process; #[cfg(feature = "with_sentry")] @@ -105,10 +105,7 @@ fn run_app_in_daemon( eprintln!("no ckb process, starting ..."); let pwd = std::env::current_dir()?; - let daemon = Daemonize::new() - .pid_file(pid_file) - .chown_pid_file(true) - .working_directory(pwd); + let daemon = Daemon::new().pid_file(pid_file, Some(false)).work_dir(pwd); match daemon.start() { Ok(_) => {