After some research there was no definitive answer as to how to have a child process understand that the parent process has died/crashed/exited under Windows which can make the child process run unattended. There are some proposals as in:
Jobs: Python: how to kill child process(es) when parent dies?
Multiprocessing: Kill Child Process if Parent is killed in Python
Always involving a known parent which has started a child. But there are cases in which the child doesn't know it is a child, because it is not conceived as a child and the parent makes no effort to kill the children.
Furthermore, there is no control of the parent. Practical case:
- Cygwin running under Windows
- Windows Python 1st in the path
- Python executable installed via
setuptoolsentry_points facility.
As mentioned above the Python to be executed is the Windows one. The setuptools-generated executable will find it and execute it as subprocess with the asocciated script.
Because one is running under Cygwin the following may fail:
- Pressing
Ctrl-cwill kill the parent (the stub setuptools executable) - But will leave the child running (to be found in the process list as
python.exe)
In this case and as mentioned above, it isn't possible to control the parent and the child doesn't know it's a child (because it may also be directly executed as a Python script)