Use signal.CTRL_C_EVENT on windows instead of signal.SIGINT#306
Use signal.CTRL_C_EVENT on windows instead of signal.SIGINT#306
Conversation
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
hidmic
left a comment
There was a problem hiding this comment.
I presume you tried this and it works. If so, I wonder why Python documentation states we need custom subprocess creation flags to make it work.
I've tried and it works well. I've also read that part of the documentation, and I forgot about it after seeing that it was working 😄. This PR doesn't solve the following problem: a Python program catching |
After further testing, I realized that when I send the ctrl_c_event, the parent process was also being finished 😄 (it wasn't a problem in the example I tried). I will just close this, and wait for an answer in pypa/setuptools#1818. |
|
For what it is worth, this change does solve the "zombie" Python processes I reported over in ros2/demos#107 (comment) . I guess it is still not the correct solution, but at least for that use case it is definitely an improvement. |
The problem is that it isn't just killing the child process, is killing the launch service itself (it's in the same process group, and ctrl_c_event work in that way on windows). The "zombie" python process is generated because the installed executable wrapper of the python program (by I haven't found a workaround for this combination of unfortunate bugs on Windows (sending SIGINT to asincio subprocesses is broken, creating subprocesses with CREATE_NEW_PROCESS_GROUP creationflag seems to be broken, setuptools installed console_scripts handles Note: Here is a branch of |
|
I haven't tried escalating to |
We were using
signal.SIGTERMon windows instead ofsignal.SIGINT.I think that
signal.CTRL_C_EVENTis the correct signal to be send in replacement ofsignal.SIGINT, which is not supported in SubprocessTransport.send_signal.Related with ros2/ros2cli#315.
See pypa/setuptools#1818.