pub type LaunchResult<T> = Result<T, LaunchError>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum LaunchError {
#[error("{0}")]
Io(std::io::Error),
#[cfg_attr(doc_cfg, doc(cfg(unix)))]
#[cfg(unix)]
#[error("{0}")]
Ipc(ipc_channel::ipc::IpcError),
#[cfg_attr(doc_cfg, doc(cfg(unix)))]
#[cfg(unix)]
#[error("Failed to fork game process")]
ProcessForking,
#[cfg_attr(doc_cfg, doc(cfg(unix)))]
#[cfg(unix)]
#[error("Failed to wait for the game process to exit. There may be a zombie process left.")]
WaitPid,
}
impl From<std::io::Error> for LaunchError {
fn from(err: std::io::Error) -> Self {
Self::Io(err)
}
}
#[cfg(unix)]
impl From<ipc_channel::ipc::IpcError> for LaunchError {
fn from(err: ipc_channel::ipc::IpcError) -> Self {
Self::Ipc(err)
}
}