Skip to content

rust: library: Add setsid method to CommandExt trait #142391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2025

Conversation

LevitatingBusinessMan
Copy link
Contributor

@LevitatingBusinessMan LevitatingBusinessMan commented Jun 12, 2025

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: #105376

ACP: rust-lang/libs-team#184

This PR was previously submitted by @HarveyHunt (whom I marked as Co-Author in the commit message) in #105377. However that PR went stale.

I applied the suggestion to change the function signature to fn setsid(&mut self, setsid: bool) -> &mut Command.

@rustbot
Copy link
Collaborator

rustbot commented Jun 12, 2025

r? @workingjubilee

rustbot has assigned @workingjubilee.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 12, 2025
@rustbot

This comment has been minimized.

@LevitatingBusinessMan
Copy link
Contributor Author

@rustbot label +T-libs-api -T-libs

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 12, 2025
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member

this doesn't finish building so I don't know what I should be reviewing?

@LevitatingBusinessMan
Copy link
Contributor Author

LevitatingBusinessMan commented Jul 1, 2025

It appears only Linux supports libc::POSIX_SPAWN_SETSID, so the compilation fails on other systems. I am still contemplating the best way to fix this.

I guess it should use the exec+fork method instead when setsid is set and the os is not linux?

I am also kind of confused as to why compilation didn't fail in the previous PR.

@workingjubilee
Copy link
Member

We have significantly adjusted what we test in "PR CI", the subset of tests we run on every open PR against rust-lang/rust.

@workingjubilee
Copy link
Member

also there is a nightly os::linux::process::CommandExt https://doc.rust-lang.org/std/os/linux/process/trait.CommandExt.html

@workingjubilee
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 4, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

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.

Co-Authored-By: Harvey Hunt <[email protected]>
@LevitatingBusinessMan
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 10, 2025
@workingjubilee
Copy link
Member

Sure, this seems fine as a nightly impl. We should mention the libc issue in the tracking issue.

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 10, 2025

📌 Commit e0f7687 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 10, 2025
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 10, 2025
@workingjubilee
Copy link
Member

@bors rollup

tgross35 added a commit to tgross35/rust that referenced this pull request Jul 10, 2025
…rkingjubilee

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#105376

ACP: rust-lang/libs-team#184

This PR was previously submitted by `@HarveyHunt` (whom I marked as Co-Author in the commit message) in rust-lang#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`.
bors added a commit that referenced this pull request Jul 11, 2025
Rollup of 7 pull requests

Successful merges:

 - #142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - #143301 (`tests/ui`: A New Order [26/N])
 - #143302 (`tests/ui`: A New Order [27/N])
 - #143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - #143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - #143708 (fix: Include frontmatter in -Zunpretty output )
 - #143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 11, 2025
Rollup of 7 pull requests

Successful merges:

 - #142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - #143301 (`tests/ui`: A New Order [26/N])
 - #143302 (`tests/ui`: A New Order [27/N])
 - #143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - #143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - #143708 (fix: Include frontmatter in -Zunpretty output )
 - #143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 11, 2025
Rollup of 8 pull requests

Successful merges:

 - #142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - #143302 (`tests/ui`: A New Order [27/N])
 - #143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - #143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - #143611 (Mention more APIs in `ParseIntError` docs)
 - #143661 (chore: Improve how the other suggestions message gets rendered)
 - #143708 (fix: Include frontmatter in -Zunpretty output )
 - #143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 11, 2025
Rollup of 8 pull requests

Successful merges:

 - #142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - #143302 (`tests/ui`: A New Order [27/N])
 - #143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - #143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - #143611 (Mention more APIs in `ParseIntError` docs)
 - #143661 (chore: Improve how the other suggestions message gets rendered)
 - #143708 (fix: Include frontmatter in -Zunpretty output )
 - #143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 11, 2025
Rollup of 8 pull requests

Successful merges:

 - #142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - #143302 (`tests/ui`: A New Order [27/N])
 - #143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - #143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - #143611 (Mention more APIs in `ParseIntError` docs)
 - #143661 (chore: Improve how the other suggestions message gets rendered)
 - #143708 (fix: Include frontmatter in -Zunpretty output )
 - #143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: i686-gnu-nopt-1
try-job: test-various
bors added a commit that referenced this pull request Jul 11, 2025
Rollup of 8 pull requests

Successful merges:

 - #142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - #143302 (`tests/ui`: A New Order [27/N])
 - #143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - #143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - #143611 (Mention more APIs in `ParseIntError` docs)
 - #143661 (chore: Improve how the other suggestions message gets rendered)
 - #143708 (fix: Include frontmatter in -Zunpretty output )
 - #143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: i686-gnu-nopt-1
try-job: test-various
bors added a commit that referenced this pull request Jul 12, 2025
Rollup of 8 pull requests

Successful merges:

 - #142391 (rust: library: Add `setsid` method to `CommandExt` trait)
 - #143302 (`tests/ui`: A New Order [27/N])
 - #143303 (`tests/ui`: A New Order [28/28] FINAL PART)
 - #143568 (std: sys: net: uefi: tcp4: Add timeout support)
 - #143611 (Mention more APIs in `ParseIntError` docs)
 - #143661 (chore: Improve how the other suggestions message gets rendered)
 - #143708 (fix: Include frontmatter in -Zunpretty output )
 - #143718 (Make UB transmutes really UB in LLVM)

r? `@ghost`
`@rustbot` modify labels: rollup

try-job: i686-gnu-nopt-1
try-job: test-various
@bors bors merged commit 2730beb into rust-lang:master Jul 12, 2025
11 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 12, 2025
rust-timer added a commit that referenced this pull request Jul 12, 2025
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: #105376

ACP: rust-lang/libs-team#184

This PR was previously submitted by ``@HarveyHunt`` (whom I marked as Co-Author in the commit message) in #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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-unix Operating system: Unix-like S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants