-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add CreateNewProcessGroup to ProcessStartInfo #117105
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for creating a new process group via a CreateNewProcessGroup
property on ProcessStartInfo
. It extends the Windows implementation, stubs the API on Unix with proper exceptions, and includes interop constants plus cross-platform tests.
- Introduces a new
CreateNewProcessGroup
property inProcessStartInfo
(Windows) and a stub on Unix. - Updates the Windows
StartWithCreateProcess
path to include theCREATE_NEW_PROCESS_GROUP
flag and adds the corresponding interop constant. - Adds tests to verify the property behavior on both platforms and a signal‐handling scenario using remote executor.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/libraries/System.Diagnostics.Process/tests/*.csproj | Linked additional interop files: BOOL, SetConsoleCtrlHandler, Unix Libraries, and PosixSignal helpers |
src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs | Added TestCreateNewProcessGroup_HandlerReceivesExpectedSignal to exercise signal dispatch |
src/libraries/System.Diagnostics.Process/tests/ProcessTests.Windows.cs | Implemented SendSignal and ReEnableCtrlCHandlerIfNeeded for Windows |
src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs | Implemented SendSignal stub and no-op ReEnableCtrlCHandlerIfNeeded for Unix |
src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs | Added unit tests for CreateNewProcessGroup on Windows and Unix |
src/libraries/System.Diagnostics.Process/tests/Interop.cs | Added GenerateConsoleCtrlEvent DllImport |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Windows.cs | Added CreateNewProcessGroup property |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs | Added stub CreateNewProcessGroup with PlatformNotSupportedException |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs | ORs CREATE_NEW_PROCESS_GROUP into the creation flags |
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ProcessOptions.cs | Added CREATE_NEW_PROCESS_GROUP constant |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.Unix.cs
Show resolved
Hide resolved
RemoteExecutor timeouts on CI (1, 2), presumably I think preventing the test from running on CI but keep running locally may be good enough for Windows. |
…g SendSignal exception.
Error narrowed to only the Windows docker image, I suspect is because is running without @dotnet/runtime-infrastructure can you please confirm and take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The product changes looks good to me, I had some questions regarding the tests, but mostly to get a better understanding. Big thanks for taking the extra effort to implement the tests for the new feature! 👍
Will fix #44944, provided that API review approves it.