Skip to content

Commit

Permalink
feat: use process_group() from std (available since Rust 1.64)
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Jan 12, 2025
1 parent ff834da commit 76de1d5
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/std/process_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,7 @@ impl ProcessGroupChild {
impl StdCommandWrapper for ProcessGroup {
#[cfg_attr(feature = "tracing", instrument(level = "debug", skip(self)))]
fn pre_spawn(&mut self, command: &mut Command, _core: &StdCommandWrap) -> Result<()> {
#[cfg(Std_unstable)]
{
command.process_group(self.leader.as_raw());
}

#[cfg(not(Std_unstable))]
let leader = self.leader;
unsafe {
command.pre_exec(move || {
setpgid(Pid::this(), leader)
.map_err(Error::from)
.map(|_| ())
});
}

command.process_group(self.leader.as_raw());
Ok(())
}

Expand Down

0 comments on commit 76de1d5

Please sign in to comment.