command_group/stdlib/
windows.rs1use std::{
2 os::windows::{io::AsRawHandle, process::CommandExt},
3 process::Command,
4};
5use winapi::um::winbase::CREATE_SUSPENDED;
6
7use crate::{builder::CommandGroupBuilder, winres::*, GroupChild};
8
9impl CommandGroupBuilder<'_, Command> {
10 pub fn spawn(&mut self) -> std::io::Result<GroupChild> {
30 self.command
31 .creation_flags(self.creation_flags | CREATE_SUSPENDED);
32
33 let (job, completion_port) = job_object(self.kill_on_drop)?;
34 let child = self.command.spawn()?;
35 assign_child(child.as_raw_handle(), job)?;
36
37 Ok(GroupChild::new(child, job, completion_port))
38 }
39}