Message389143
I'd prefer to change os.kill() to take the code path that generates a console control event only when the pid value is negative (i.e. a process group ID), with -1 reserved to send the event to all processes in the console session (i.e. console process group 0). Also, in this case, I'd map SIGINT and SIGBREAK to CTRL_C_EVENT and CTRL_BREAK_EVENT, instead of directly using the Windows API constants. Such a design conforms better with POSIX kill() [1], and it cleanly separates the GenerateConsoleCtrlEvent() and TerminateProcess() usage.
The older usage with kill(non_negative_pid, console_control_event) could be retained by checking for the enum instances signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT by object ID instead of by value.
---
[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html |
|
Date |
User |
Action |
Args |
2021-03-20 04:05:29 | eryksun | set | recipients:
+ eryksun, jpe, paul.moore, giampaolo.rodola, tim.golden, zach.ware, steve.dower |
2021-03-20 04:05:29 | eryksun | set | messageid: <1616213129.5.0.393317499971.issue23948@roundup.psfhosted.org> |
2021-03-20 04:05:29 | eryksun | link | issue23948 messages |
2021-03-20 04:05:29 | eryksun | create | |
|