Open
Description
Feature gate: #![feature(windows_process_extensions_cur_creation_flags)]
This is a tracking issue for a new current_creation_flags(&self)
function on CommandExt for windows.
On windows, std currently has a creation_flags method on Commands to set creation flags. However, if a rust library needs to set a creation flag and then spawn/consume a process, it has no way of not stomping the pre-existing flags. For example:
// Consume a command in a library crate. We need to create the process suspended.
fn consume_command(c: std::process::Command) {
const CREATE_SUSPENDED: u32 = 0x00000004;
do_stuff(c.creation_flags(CREATE_SUSPENDED));
}
const CREATE_NO_WINDOW: u32 = 0x08000000;
// The creation_flags call in consume_command will overwrite the NO_WINDOW flag
consume_command(some_command.creation_flags(CREATE_NO_WINDOW));
It would be nice to have a method to get the current flags, so a library can OR the pre-existing flags to ensure it doesn't overwrite them accidentally.
Public API
// std::process
pub trait CommandExt: Sealed {
#[unstable(feature = "windows_process_extensions_cur_creation_flags", issue = "96723")]
fn current_creation_flags(&self) -> u32;
}
Steps / History
- Implementation: #...
- Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- None yet.