rskit_process/command/
signal.rs1use std::time::Duration;
4
5#[derive(Debug, Clone, Copy, Eq, PartialEq)]
7#[non_exhaustive]
8pub struct SignalPolicy {
9 pub grace_period: Duration,
11 pub create_process_group: bool,
13 pub terminate_descendants: bool,
15}
16
17impl Default for SignalPolicy {
18 fn default() -> Self {
19 Self {
20 grace_period: Duration::from_secs(5),
21 create_process_group: true,
22 terminate_descendants: true,
23 }
24 }
25}
26
27impl SignalPolicy {
28 #[must_use]
30 pub fn with_grace_period(mut self, grace_period: Duration) -> Self {
31 self.grace_period = grace_period;
32 self
33 }
34
35 #[must_use]
37 pub fn with_create_process_group(mut self, create_process_group: bool) -> Self {
38 self.create_process_group = create_process_group;
39 self
40 }
41
42 #[must_use]
44 pub fn with_terminate_descendants(mut self, terminate_descendants: bool) -> Self {
45 self.terminate_descendants = terminate_descendants;
46 self
47 }
48}