|RE: [cdt-dev] Win32 spawner|
Good question. I think it has something to do with allowing the child process to clean up. Also, TerminateProcess only kills that process, not the children of that process. But I think there is a way to do that too, but it involves a lot of code.
Feel free to try and improve it. It probably needs it. Just make sure you don't break gdb spawning :)
BTW, I've worked a little over the past go get everything that doesn't need the spawner's signaling capability off of it and onto Java's Runtime.exec. It seems to work better in certain situations.
- From: cdt-dev-bounces@xxxxxxxxxxx [ mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of John Cortell
- Sent: Wednesday, July 16, 2008 4:36 PM
- To: CDT General developers list.
- Subject: [cdt-dev] Win32 spawner
- I've been trying to figure out why Spawner.kill() isn't killing a process for us. The "process", in our case, is our debugger engine--a Win32 executable. We use the spawner to launch it, and on shutdown, we sometimes need to abruptly kill it (if it's taking too long to shut down gracefully). Again, calling kill() on the Process object, which is a Spawner, isn't doing the trick.
- I found the answer in starter.cpp. It contains a handler which waits for the terminate event-handle to be signaled and then goes about trying to kill the process it earlier created. Problem is: it does so by sending a console CTRL-C event (unless it's a cygwin process, in which case it runs a "kill -SIGTERM" command). In our case, the process is not a cygwin process. The CTRL-C event isn't doing the trick, and I have to wonder...why aren't we just using the TerminateProcess Win32 function? We have the process handle, after all. I've coded it and it's working. I'm just scratching my head wondering why we'd try sending a CTRL-C instead.
cdt-dev mailing list