This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients davin, docs@python, eryksun, jmarshall, miss-islington, pitrou
Date 2022-01-18.22:29:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642544993.93.0.131263227182.issue45554@roundup.psfhosted.org>
In-reply-to
Content
PR 30142 is sufficient for Unix, but it's missing a bit for Windows.

In Windows, the C runtime library maps the console event for Ctrl+Break to SIGBREAK. The default handler for SIGBREAK exits with 0xC000013A (i.e. STATUS_CONTROL_C_EXIT). This value is unrelated to the value of signal.SIGBREAK (21) or signal.SIGINT (2).

To forcefully terminate a process, Windows taskkill and Task Manager, and pretty much all utilities that can kill a process, call TerminateProcess() with 1 as the exit status. There's no way to know that this is a forced termination as opposed to an unhandled error.

The internal terminate() method in Windows uses 0x10000 as the real exit status of the process, but the internal wait() method maps this to -signal.SIGTERM (-15). Thus the case of calling Process.terminate(), and only this case, is faked in Windows to look like the process was killed by a signal.
History
Date User Action Args
2022-01-18 22:29:53eryksunsetrecipients: + eryksun, pitrou, docs@python, davin, miss-islington, jmarshall
2022-01-18 22:29:53eryksunsetmessageid: <1642544993.93.0.131263227182.issue45554@roundup.psfhosted.org>
2022-01-18 22:29:53eryksunlinkissue45554 messages
2022-01-18 22:29:53eryksuncreate