-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Provide an API for std::process::Command to set CreateProcess flags on Windows #37827
Copy link
Copy link
Closed
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.O-windowsOperating system: WindowsOperating system: WindowsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Metadata
Metadata
Assignees
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.O-windowsOperating system: WindowsOperating system: WindowsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Updated report
Now a tracking issue for
CommandExt::creation_flagson Windows.Open questions:
Also, don't forget to add to the prelude when stabilizing!
Original report
There's a currently-unused codepath in the Windows implementation of
std::process::Command::spawnthat can setDETATCHED_PROCESS:rust/src/libstd/sys/windows/process.rs
Line 162 in b1363a7
It looks like historically there was a method to set this but it got removed. Unfortunately there's currently no way to set this, and no other way to set the
CreateProcessflags, so for a project I'm working on I basically had to reimplementspawnfor Windows:https://github.com/luser/sccache2/blob/89f4b44d01084846893a64137d965ee844fe2d72/src/commands.rs#L103
I think we need some way to set this, even if it's Windows-specific. There are a bunch of other flags that can be specified, so maybe a way to set arbitrary flags would be useful?
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
I think this would fit nicely onto a Windows equivalent of the
std::os::unix::process::CommandExttrait, maybe something like: