1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//!

/// CommandGroupBuilder is a builder for a group of processes.
///
/// It is created via the `group` method on [`Command`](std::process::Command) or
/// [`AsyncCommand`](tokio::process::Command).
pub struct CommandGroupBuilder<'a, T> {
	pub(crate) command: &'a mut T,
	#[allow(dead_code)]
	pub(crate) kill_on_drop: bool,
	#[allow(dead_code)]
	pub(crate) creation_flags: u32,
}

impl<'a, T> CommandGroupBuilder<'a, T> {
	pub(crate) fn new(command: &'a mut T) -> Self {
		Self {
			command,
			kill_on_drop: false,
			creation_flags: 0,
		}
	}

	/// See [`tokio::process::Command::kill_on_drop`].
	#[cfg(any(windows, feature = "with-tokio"))]
	pub fn kill_on_drop(&mut self, kill_on_drop: bool) -> &mut Self {
		self.kill_on_drop = kill_on_drop;
		self
	}

	/// Set the creation flags for the process.
	#[cfg(windows)]
	pub fn creation_flags(&mut self, creation_flags: u32) -> &mut Self {
		self.creation_flags = creation_flags;
		self
	}
}