use core::fmt;
use tokio::sync::oneshot;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ExitOutcome {
pub code: Option<i32>,
pub signal: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LogLine {
pub err: bool,
pub line: String,
}
#[derive(Debug)]
#[non_exhaustive]
pub enum LogCtl {
Reopen {
done: oneshot::Sender<Result<(), ReopenError>>,
},
Flush {
done: oneshot::Sender<Result<(), FlushError>>,
},
#[cfg(unix)]
ReportFds {
done: oneshot::Sender<crate::handover::CarriedFds>,
},
#[cfg(unix)]
Resume,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ReopenError {
pub message: String,
}
impl fmt::Display for ReopenError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "could not reopen {}", self.message)
}
}
impl core::error::Error for ReopenError {}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FlushError {
pub message: String,
}
impl fmt::Display for FlushError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "could not flush {}", self.message)
}
}
impl core::error::Error for FlushError {}