diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-07-11 07:35:17 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-11 07:35:17 +0200 | 
| commit | 2730bebbf88ae9473b339bb7f66eb77fb2c9fa6f (patch) | |
| tree | afb134a4eb5d5a8289e22a79c3bc9c26b7fd28dc /library/std/src/os/unix/process.rs | |
| parent | cdac44e608c3df9a241e0a1b53b3f62af250dbf1 (diff) | |
| parent | e0f76871eddd0f1345eba7d09e5ab4812f8aa91d (diff) | |
| download | rust-2730bebbf88ae9473b339bb7f66eb77fb2c9fa6f.tar.gz rust-2730bebbf88ae9473b339bb7f66eb77fb2c9fa6f.zip | |
Rollup merge of #142391 - LevitatingBusinessMan:setsid, r=workingjubilee
rust: library: Add `setsid` method to `CommandExt` trait Add a setsid method to the CommandExt trait so that callers can create a process in a new session and process group whilst still using the POSIX spawn fast path. Tracking issue: rust-lang/rust#105376 ACP: https://github.com/rust-lang/libs-team/issues/184 This PR was previously submitted by ``@HarveyHunt`` (whom I marked as Co-Author in the commit message) in rust-lang/rust#105377. However that PR went stale. I applied the [suggestion](https://github.com/rust-lang/rust/pull/105377/files/231d19fcbfe155b2e85116865adae4253380ff1f#r1893457943) to change the function signature to `fn setsid(&mut self, setsid: bool) -> &mut Command`.
Diffstat (limited to 'library/std/src/os/unix/process.rs')
| -rw-r--r-- | library/std/src/os/unix/process.rs | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs index 466b134d8fa..76e63a69e45 100644 --- a/library/std/src/os/unix/process.rs +++ b/library/std/src/os/unix/process.rs @@ -210,6 +210,9 @@ pub trait CommandExt: Sealed { /// intentional difference from the underlying `chroot` system call.) #[unstable(feature = "process_chroot", issue = "141298")] fn chroot<P: AsRef<Path>>(&mut self, dir: P) -> &mut process::Command; + + #[unstable(feature = "process_setsid", issue = "105376")] + fn setsid(&mut self, setsid: bool) -> &mut process::Command; } #[stable(feature = "rust1", since = "1.0.0")] @@ -260,6 +263,11 @@ impl CommandExt for process::Command { self.as_inner_mut().chroot(dir.as_ref()); self } + + fn setsid(&mut self, setsid: bool) -> &mut process::Command { + self.as_inner_mut().setsid(setsid); + self + } } /// Unix-specific extensions to [`process::ExitStatus`] and | 
