use std::{
io::Result,
process::{Command, ExitStatus, Output},
};
use crate::{builder::CommandGroupBuilder, GroupChild};
#[cfg(target_family = "windows")]
mod windows;
#[cfg(target_family = "unix")]
mod unix;
pub(crate) mod child;
pub trait CommandGroup {
fn group_spawn(&mut self) -> Result<GroupChild> {
self.group().spawn()
}
fn group(&mut self) -> CommandGroupBuilder<std::process::Command>;
fn group_output(&mut self) -> Result<Output> {
self.group_spawn()
.and_then(|child| child.wait_with_output())
}
fn group_status(&mut self) -> Result<ExitStatus> {
self.group_spawn().and_then(|mut child| child.wait())
}
}
impl CommandGroup for Command {
fn group<'a>(&'a mut self) -> CommandGroupBuilder<'a, Command> {
CommandGroupBuilder::new(self)
}
}