Skip to content

Commit

Permalink
fix cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Dec 26, 2023
1 parent 44cc345 commit 6e975a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion ckb-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ repository = "https://github.com/nervosnetwork/ckb"

[dependencies]
clap = { version = "4" }
daemonize = { version = "0.5.0" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
serde_plain = "0.3.0"
Expand Down Expand Up @@ -46,7 +45,9 @@ sentry = { version = "0.26.0", optional = true }
is-terminal = "0.4.7"
fdlimit = "0.2.1"
ckb-stop-handler = { path = "../util/stop-handler", version = "= 0.114.0-pre" }

[target.'cfg(not(target_os="windows"))'.dependencies]
daemonize = { version = "0.5.0" }
nix = { version = "0.24.0", default-features = false, features = ["signal"] }
colored = "2.0"

Expand Down
21 changes: 11 additions & 10 deletions ckb-bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ use ckb_build_info::Version;
use ckb_logger::{debug, info};
use ckb_network::tokio;
use clap::ArgMatches;
use colored::Colorize;
use daemonize::Daemonize;
use helper::raise_fd_limit;
use setup_guard::SetupGuard;

#[cfg(not(target_os = "windows"))]
use colored::Colorize;
#[cfg(not(target_os = "windows"))]
use daemonize::Daemonize;
#[cfg(not(target_os = "windows"))]
use subcommand::check_process;

#[cfg(feature = "with_sentry")]
pub(crate) const LOG_TARGET_SENTRY: &str = "sentry";

Expand Down Expand Up @@ -62,14 +63,16 @@ pub fn run_app(version: Version) -> Result<(), ExitCode> {
.subcommand()
.expect("SubcommandRequiredElseHelp");

#[cfg(not(target_os = "windows"))]
if run_deamon(cmd, matches) {
run_app_in_daemon(version, bin_name, cmd, matches)
} else {
debug!("ckb version: {}", version);
run_app_inner(version, bin_name, cmd, matches)
return run_app_in_daemon(version, bin_name, cmd, matches);
}

debug!("ckb version: {}", version);
run_app_inner(version, bin_name, cmd, matches)
}

#[cfg(not(target_os = "windows"))]
fn run_app_in_daemon(
version: Version,
bin_name: String,
Expand Down Expand Up @@ -151,10 +154,8 @@ fn run_app_inner(
ret
}

#[cfg(not(target_os = "windows"))]
fn run_deamon(cmd: &str, matches: &ArgMatches) -> bool {
#[cfg(target_os = "windows")]
return false;

match cmd {
cli::CMD_RUN => matches.get_flag(cli::ARG_DAEMON),
_ => false,
Expand Down

0 comments on commit 6e975a5

Please sign in to comment.