Skip to content

Commit

Permalink
only compile daemonize on *NIX systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidson-Souza committed Aug 27, 2024
1 parent 8982df0 commit 9e44afa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion florestad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ jsonrpc-core-client = { version = "18.0.0", features = [
], optional = true }
zmq = { version = "0.10.0", optional = true }
latest = "0.1.1"
daemonize = "0.5.0"

[target.'cfg(unix)'.dependencies]
daemonize = { version = "0.5.0" }

[lib]
name = "florestad"
Expand Down
2 changes: 2 additions & 0 deletions florestad/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@ pub struct Cli {
/// height will be fully validated.
pub assume_utreexo: bool,

#[cfg(unix)]
#[arg(long, default_value = "false")]
/// Whether we should run as a daemon
pub daemon: bool,

#[cfg(unix)]
#[arg(long, value_name = "FILE", requires = "daemon")]
/// A file to write the process id to
///
Expand Down
2 changes: 2 additions & 0 deletions florestad/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::time::Duration;

use clap::Parser;
use cli::Cli;
#[cfg(unix)]
use daemonize::Daemonize;
use florestad::Config;
use florestad::Florestad;
Expand Down Expand Up @@ -55,6 +56,7 @@ fn main() {
assumeutreexo_value: None,
};

#[cfg(unix)]
if params.daemon {
let mut daemon = Daemonize::new();
if let Some(pid_file) = params.pid_file {
Expand Down

0 comments on commit 9e44afa

Please sign in to comment.