about summary refs log tree commit diff
path: root/library/std/src/os/unix/process.rs
diff options
context:
space:
mode:
authorThomas Orozco <torozco@fb.com>2022-02-03 09:40:45 +0000
committerThomas Orozco <torozco@fb.com>2022-03-14 14:33:41 +0000
commitb628497b7cf8235a7f74fa037e86051fa78b5188 (patch)
treef6b1fc0c1a363eab898ec570ac19aeadff6b6f56 /library/std/src/os/unix/process.rs
parentdca1e7aa5a8ac05ddaea731f4eab20de91acb46b (diff)
downloadrust-b628497b7cf8235a7f74fa037e86051fa78b5188.tar.gz
rust-b628497b7cf8235a7f74fa037e86051fa78b5188.zip
Add a `process_group` method to UNIX `CommandExt`
Diffstat (limited to 'library/std/src/os/unix/process.rs')
-rw-r--r--library/std/src/os/unix/process.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs
index 855f900430c..d95bc9b15c9 100644
--- a/library/std/src/os/unix/process.rs
+++ b/library/std/src/os/unix/process.rs
@@ -149,6 +149,11 @@ pub trait CommandExt: Sealed {
     fn arg0<S>(&mut self, arg: S) -> &mut process::Command
     where
         S: AsRef<OsStr>;
+
+    /// Sets the process group ID of the child process. Translates to a `setpgid` call in the child
+    /// process.
+    #[unstable(feature = "process_set_process_group", issue = "93857")]
+    fn process_group(&mut self, pgroup: i32) -> &mut process::Command;
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -201,6 +206,11 @@ impl CommandExt for process::Command {
         self.as_inner_mut().set_arg_0(arg.as_ref());
         self
     }
+
+    fn process_group(&mut self, pgroup: i32) -> &mut process::Command {
+        self.as_inner_mut().pgroup(pgroup);
+        self
+    }
 }
 
 /// Unix-specific extensions to [`process::ExitStatus`] and