Fix Windows process group example: CTRL_BREAK_EVENT, not CTRL_C_EVENT#53564
Open
Fix Windows process group example: CTRL_BREAK_EVENT, not CTRL_C_EVENT#53564
Conversation
…T for process groups Agent-Logs-Url: https://github.com/dotnet/docs/sessions/f36bbc2c-5f0f-4b18-a5de-6f801890df6d Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix signal used in Launch Windows processes example
Fix Windows process group example: CTRL_BREAK_EVENT, not CTRL_C_EVENT
May 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the .NET 10 “Windows process management” snippet so it can actually signal a child process launched in a non-default process group. It updates the parent to use CTRL_BREAK_EVENT (instead of CTRL_C_EVENT), aligns the child’s managed signal handler with that event, and removes an unnecessary SetConsoleCtrlHandler call while clarifying the behavior in comments.
Changes:
- Send
CTRL_BREAK_EVENTfrom the parent when targeting the child process group. - Handle
CTRL+BREAKin the child viaPosixSignal.SIGQUITand update the log message accordingly. - Remove the
SetConsoleCtrlHandler(NULL, FALSE)call and replace it with a clearer explanation of when it’s needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GenerateConsoleCtrlEventwithCTRL_C_EVENTsilently succeeds but delivers no signal when the target process group ID is non-zero. The example was broken by design.Changes
CTRL_C_EVENT→CTRL_BREAK_EVENT— the only valid choice when targeting a non-default process groupPosixSignal.SIGINT→PosixSignal.SIGQUIT— on Windows,SIGQUITmaps toCTRL_BREAK_EVENT;SIGINTmaps toCTRL_C_EVENTSetConsoleCtrlHandler(NULL, FALSE)call —CREATE_NEW_PROCESS_GROUPdisables CTRL+C, not CTRL+BREAK, so re-enabling isn't needed here; updated comment to explain the distinction and note when the call is required