Skip to content

Tracking issue windows_process_extensions_cur_creation_flags #96794

Open
@nico-abram

Description

@nico-abram

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-processArea: `std::process` and `std::env`C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions