cli: Gracefully handle failure to link log file
Not linking `node.log` is not ideal, but also not a critical failure. It's better to swallow that instead of crashing.
This commit is contained in:
parent
de78cf7874
commit
ed5b2659c8
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue