Skip to content
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

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

Closed
hach-que opened this issue Aug 15, 2023 · 2 comments
Closed

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

hach-que opened this issue Aug 15, 2023 · 2 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Diagnostics.Process

Comments

@hach-que
Copy link
Contributor

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

@hach-que hach-que added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Aug 15, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 15, 2023
@ghost
Copy link

ghost commented Aug 15, 2023

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: hach-que
Assignees: -
Labels:

api-suggestion, area-System.Diagnostics.Process, untriaged

Milestone: -

@hach-que
Copy link
Contributor Author

Oh I see this is a duplicate of #71515.

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Aug 15, 2023
@hach-que hach-que closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Diagnostics.Process
Projects
None yet
Development

No branches or pull requests

1 participant