Comment 11 for bug 277082

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

Alexander Belchenko wrote:
> Is there any important reason why we cannot use support for killing process via Qt method? ... On Windows, kill() uses TerminateProcess...

When you press ctr-c, a SIGINT signal is sent to your process. This causes python to raise a KeyboardInterupt exception in the current thread. Hence, if you have a try...finally block, and the execution was in the try block when the KeyboardInterupt exception was raised, the code in the finally block will run. This does not happen if you call TerminateProcess/SIGKILL. The most visible effect of this is that locks aren't unlocked.

Alexander Belchenko wrote:
> http://www.microsoft.com/msj/0698/win320698.aspx

This article mentions GenerateConsoleCtrlEvent. I have spent many hours trying to get this to work. One problem I have encounter is that you need to pass CREATE_NEW_PROCESS_ GROUP to CreateProcess. This call is warped in QProcess.start(). So if we were to use this, we would need to drop the use of QProcess, and rewrite a lot of code related to handling stdout/stderr.