node: Restrict use of systemd to Linux not Unix
Building with Zigbuild for macOS caused build issues. Strengthen the condition for using systemd from the Unix family to Linux specifically.
This commit is contained in:
parent
11d29b280a
commit
944d394247
|
|
@ -39,7 +39,6 @@ radicle-fetch = { workspace = true }
|
|||
radicle-git-ext = { workspace = true, features = ["serde"] }
|
||||
radicle-protocol = { workspace = true }
|
||||
radicle-signals = { workspace = true }
|
||||
radicle-systemd = { workspace = true, optional = true }
|
||||
sqlite = { workspace = true, features = ["bundled"] }
|
||||
scrypt = { version = "0.11.0", default-features = false }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
|
|
@ -49,6 +48,9 @@ socket2 = "0.5.7"
|
|||
tempfile = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
radicle-systemd = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
qcheck = { workspace = true }
|
||||
qcheck-macros = { workspace = true }
|
||||
|
|
@ -56,4 +58,4 @@ radicle = { workspace = true, features = ["test"] }
|
|||
radicle-protocol = { workspace = true, features = ["test"] }
|
||||
radicle-crypto = { workspace = true, features = ["test", "cyphernet"] }
|
||||
snapbox = { workspace = true }
|
||||
test-log = "0.2.18"
|
||||
test-log = "0.2.18"
|
||||
|
|
|
|||
|
|
@ -93,10 +93,15 @@ fn execute() -> anyhow::Result<()> {
|
|||
let level = options.log.unwrap_or(config.node.log);
|
||||
|
||||
let logger = {
|
||||
let journal = if cfg!(all(feature = "systemd", target_family = "unix")) {
|
||||
radicle_systemd::journal::logger::<&str, &str, _>("radicle-node".to_string(), [])?
|
||||
} else {
|
||||
None
|
||||
let journal = {
|
||||
#[cfg(all(feature = "systemd", target_os = "linux"))]
|
||||
{
|
||||
radicle_systemd::journal::logger::<&str, &str, _>("radicle-node".to_string(), [])?
|
||||
}
|
||||
#[cfg(not(all(feature = "systemd", target_os = "linux")))]
|
||||
{
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(logger) = journal {
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ impl Runtime {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "systemd", target_family = "unix"))]
|
||||
#[cfg(all(feature = "systemd", target_os = "linux"))]
|
||||
fn receive_listener() -> Option<UnixListener> {
|
||||
use std::os::fd::FromRawFd;
|
||||
match radicle_systemd::listen::fd("control") {
|
||||
|
|
@ -371,7 +371,7 @@ impl Runtime {
|
|||
}
|
||||
|
||||
fn bind(path: PathBuf) -> Result<ControlSocket, Error> {
|
||||
#[cfg(all(feature = "systemd", target_family = "unix"))]
|
||||
#[cfg(all(feature = "systemd", target_os = "linux"))]
|
||||
{
|
||||
if let Some(listener) = Self::receive_listener() {
|
||||
log::info!(target: "node", "Received control socket.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue