Can I send SIGINT to a Python subprocess on Windows?

耗尽温柔 提交于 2019-12-10 14:49:21

问题


I've got a Python script managing a gdb process on Windows, and I need to be able to send a SIGINT to the spawned process in order to halt the target process (managed by gdb)

It appears that there is only SIGTERM available in Win32, but clearly if I run gdb from the console and Ctrl+C, it thinks it's receiving a SIGINT. Is there a way I can fake this such that the functionality is available on all platforms?

(I am using the subprocess module, and python 2.5/2.6)


回答1:


Windows doesn't have the unix signals IPC mechanism.

I would look at sending a CTRL-C to the gdb process.



来源:https://stackoverflow.com/questions/1095549/can-i-send-sigint-to-a-python-subprocess-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!