use process_wrap::tokio::ChildWrapper;
use std::io;
use std::pin::Pin;
#[derive(Debug)]
pub struct WrappedChild {
inner: Box<dyn ChildWrapper>,
}
impl WrappedChild {
pub fn new(inner: Box<dyn ChildWrapper>) -> Self {
Self { inner }
}
pub fn inner_mut(&mut self) -> &mut dyn ChildWrapper {
self.inner.as_mut()
}
pub async fn kill(&mut self) -> io::Result<()> {
Pin::from(self.inner.kill()).await
}
pub fn start_kill(&mut self) -> io::Result<()> {
self.inner.start_kill()
}
pub async fn wait(&mut self) -> io::Result<std::process::ExitStatus> {
self.inner.wait().await
}
pub fn try_wait(&mut self) -> io::Result<Option<std::process::ExitStatus>> {
self.inner.try_wait()
}
#[cfg(unix)]
pub fn signal(&self, sig: i32) -> io::Result<()> {
self.inner.signal(sig)
}
pub fn id(&self) -> u32 {
self.inner.id().unwrap_or(0)
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_wrapped_child_creation() {
}
}