Message389143
| Author |
eryksun |
| Recipients |
eryksun, giampaolo.rodola, jpe, paul.moore, steve.dower, tim.golden, zach.ware |
| Date |
2021年03月20日.04:05:29 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1616213129.5.0.393317499971.issue23948@roundup.psfhosted.org> |
| In-reply-to |
| Content |
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 |
|