Message255903
You can send CTRL_C_EVENT to a process group. But it requires the group leader to manually enable Ctrl+C handling. Initially it's disabled when creating a process with CREATE_NEW_PROCESS_GROUP.
The attached script demonstrates sending CTRL_C_EVENT to a process group. The child process is the group leader, so CTRL+C event processing has to be manually enabled in it by calling SetConsoleCtrlHandler(NULL, FALSE). This flag gets inherited by the grandchild process. Example output:
Process 0300: created process 0464
Process 0464: created process 0456
Process 0464: received CTRL+C
Process 0456: received CTRL+C
That said, given that MSDN [erroneously] claims that this isn't possible, probably the subprocess docs should only mention sending CTRL_BREAK_EVENT. |
|
Date |
User |
Action |
Args |
2015-12-05 00:01:03 | eryksun | set | recipients:
+ eryksun, eli.bendersky, brian.curtin, docs@python, nitika |
2015-12-05 00:01:03 | eryksun | set | messageid: <1449273663.84.0.921373037088.issue13368@psf.upfronthosting.co.za> |
2015-12-05 00:01:03 | eryksun | link | issue13368 messages |
2015-12-05 00:01:03 | eryksun | create | |
|