command_group/
builder.rs

1//!
2
3/// CommandGroupBuilder is a builder for a group of processes.
4///
5/// It is created via the `group` method on [`Command`](std::process::Command) or
6/// [`AsyncCommand`](tokio::process::Command).
7pub struct CommandGroupBuilder<'a, T> {
8	pub(crate) command: &'a mut T,
9	#[allow(dead_code)]
10	pub(crate) kill_on_drop: bool,
11	#[allow(dead_code)]
12	pub(crate) creation_flags: u32,
13}
14
15impl<'a, T> CommandGroupBuilder<'a, T> {
16	pub(crate) fn new(command: &'a mut T) -> Self {
17		Self {
18			command,
19			kill_on_drop: false,
20			creation_flags: 0,
21		}
22	}
23
24	/// See [`tokio::process::Command::kill_on_drop`].
25	#[cfg(any(windows, feature = "with-tokio"))]
26	pub fn kill_on_drop(&mut self, kill_on_drop: bool) -> &mut Self {
27		self.kill_on_drop = kill_on_drop;
28		self
29	}
30
31	/// Set the creation flags for the process.
32	#[cfg(windows)]
33	pub fn creation_flags(&mut self, creation_flags: u32) -> &mut Self {
34		self.creation_flags = creation_flags;
35		self
36	}
37}