Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cli: Gracefully handle failure to link log file
Merged lorenz opened 8 months ago

Not linking node.log is not ideal, but also not a critical failure. It’s better to swallow that instead of crashing.

1 file changed +11 -1 ed5b2659 ed5b2659
modified crates/radicle-cli/src/commands/node/logs.rs
@@ -153,11 +153,21 @@ impl Rotate {
                log::warn!(target: "cli", "Failed to remove current log file: {err}");
            }
        }
+

        let log = OpenOptions::new()
            .write(true)
            .create_new(true)
            .open(&self.next)?;
-
        fs::hard_link(&self.next, &self.link)?;
+

+
        if let Err(err) = fs::hard_link(&self.next, &self.link) {
+
            log::warn!(
+
                target: "cli",
+
                "Failed to create hard link from {} to {}: {err}",
+
                self.next.display(),
+
                self.link.display()
+
            );
+
        }
+

        Ok(Rotated {
            path: self.next,
            log,