Python – send SIGINT to a Python subprocess on Windows

pythonsigintsignal-handlingsubprocesswindows

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)

Best Answer

Windows doesn't have the unix signals IPC mechanism.

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