use std::io;
use std::path::Path;
use std::process::Child;
pub trait RunHandle: Send {
fn try_wait(&mut self) -> io::Result<Option<std::process::ExitStatus>>;
fn wait(&mut self) -> io::Result<std::process::ExitStatus>;
fn kill(&mut self) -> io::Result<()>;
}
impl RunHandle for Child {
fn try_wait(&mut self) -> io::Result<Option<std::process::ExitStatus>> {
Child::try_wait(self)
}
fn wait(&mut self) -> io::Result<std::process::ExitStatus> {
Child::wait(self)
}
fn kill(&mut self) -> io::Result<()> {
Child::kill(self)
}
}
pub struct RunCtx<'a> {
pub workdir: &'a Path,
pub token_env: &'a str,
}
pub trait Runner: Send + Sync {
fn name(&self) -> &'static str;
fn spawn(&self, ctx: &RunCtx) -> io::Result<Box<dyn RunHandle>>;
}