Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Restrict use of systemd to Linux not Unix
Lorenz Leutgeb committed 8 months ago
commit 944d39424793ddc9e4f67dcdca24e7140c5b02d5
parent 11d29b280ae9b1456ddd58cd9dcceefe3d47d60d
3 files changed +15 -8
modified crates/radicle-node/Cargo.toml
@@ -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"

\ No newline at end of file
+
test-log = "0.2.18"
modified crates/radicle-node/src/main.rs
@@ -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 {
modified crates/radicle-node/src/runtime.rs
@@ -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.");