use std::path::Path;
use thiserror::Error;
#[cfg(unix)]
pub mod unix;
#[cfg(windows)]
pub mod windows;
#[derive(Debug, Error)]
#[allow(dead_code)]
pub enum DetachError {
#[error("daemon detach failed at `{step}`: {source}")]
Syscall {
step: &'static str,
#[source]
source: std::io::Error,
},
#[error("child process reported a startup failure: {message}")]
ChildReportedFailure { message: String },
#[error("daemon detach is not supported on this platform yet")]
PlatformUnsupported,
}
pub fn detach(log_dir: &Path) -> Result<(), DetachError> {
#[cfg(unix)]
{
unix::detach(log_dir)
}
#[cfg(windows)]
{
let _ = log_dir;
windows::detach(log_dir)
}
}