shep-daemon 0.22.0

The supervision engine behind shep: process spawning, restart policy, the log plane, watch and cron restarts, and the RPC server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::path::{Path, PathBuf};

/// Anchors an explicit log path at the sheep's `cwd` when it is relative.
///
/// The shepherd opens these files itself. A bare relative path resolves
/// against its own directory, not the sheep's. The same config then names
/// one file under a handover's predecessor and another under its successor.
/// `shep bleats` reads a third under the CLI's.
pub(super) fn anchor_log_path(rendered: String, cwd: Option<&Path>) -> PathBuf {
    let path = PathBuf::from(rendered);
    match cwd {
        Some(cwd) if path.is_relative() => cwd.join(path),
        _ => path,
    }
}