Rollup merge of #93858 - krallin:process-process_group, r=dtolnay
Add a `process_group` method to UNIX `CommandExt` - Tracking issue: #93857 - RFC: https://github.com/rust-lang/rfcs/pull/3228 Add a `process_group` method to `std::os::unix::process::CommandExt` that allows setting the process group id (i.e. calling `setpgid`) in the child, thus enabling users to set process groups while leveraging the `posix_spawn` fast path.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user