Skip to content

[API Proposal]: Expose Win32 CreateProcess flags to ProcessStartInfo #90581

@hach-que

Description

@hach-que

Background and motivation

Currently I use ProcessStartInfo/Process.Start to launch processes with overridden environment variables, redirect standard input and output, and so forth.

I now need to use the CREATE_SUSPENDED flag so that I can modify the process after it's created and before it starts actual execution, but there's no way to pass this flag into ProcessStartInfo/Process.Start. Given that I still need to use all the other features of ProcessStartInfo, the only reasonable path I can see forward is to either copy or reimplement the entirety of the System.Diagnostics.Process code, just so I can pass this one flag down to the operating system, which is really less than ideal.

API Proposal

This probably isn't very good API design, but just some way of passing in the Win32 process creation flags is needed.

namespace System.Diagnostics;

public sealed partial class ProcessStartInfo
{
    [SupportedOSPlatform("windows")]
    public int ProcessCreationFlags { get; set; }
}

API Usage

ProcessStartInfo p;
p.ProcessCreationFlags = 0x00000004;

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions