use super::{Child, SuspendedChild};
use crate::child::suspended::platform::spawn_frozen;
use crate::containment::windows::{resume_initial_threads, SuspendCount};
use crate::error::Error;
use crate::tokio::spawn::spawn_uncommitted;
use crate::tokio::Command;
impl SuspendedChild {
#[doc(hidden)]
pub fn test_job_handle_contains_self(&self) -> bool {
self.child.test_job_handle_contains_self()
}
#[doc(hidden)]
pub fn test_containment(&self) -> crate::Containment {
self.child.containment()
}
}
pub(super) fn spawn(cmd: &mut Command) -> Result<SuspendedChild, Error> {
let (child, wanted_kill_on_drop) = spawn_frozen(cmd.as_sync_mut(), spawn_uncommitted)?;
Ok(SuspendedChild {
child,
wanted_kill_on_drop,
})
}
pub(super) fn release(child: &Child) -> std::io::Result<()> {
let handle = child
.process_handle()
.expect("a frozen child's process handle is held until it is resumed");
resume_initial_threads(handle, SuspendCount::ExactlyOne)
}