Gary van der Merwe пишет:
> 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.
Thanks for explanation, but current usage of os.kill anyway wrong on win32.
> 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.
>
Gary, you mentioned thread.interrupt_main function. Will it work for us?
I've played with win32event module, so I think we can send signal from main
GUI dialog to subprocess via win32 Events. And we can wait for the Event
in separate thread in qsubprocess to have ability using interrupt_main.
So I'm planning to test this idea, if you don't try it before me.
Gary van der Merwe пишет: s/SIGKILL. The most visible effect of this is that locks
> 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
> TerminateProces
> aren't unlocked.
Thanks for explanation, but current usage of os.kill anyway wrong on win32.
> Alexander Belchenko wrote: www.microsoft. com/msj/ 0698/win320698. aspx CtrlEvent. I have spent many hours
>> http://
>
> This article mentions GenerateConsole
> 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.
>
Gary, you mentioned thread. interrupt_ main function. Will it work for us?
I've played with win32event module, so I think we can send signal from main
GUI dialog to subprocess via win32 Events. And we can wait for the Event
in separate thread in qsubprocess to have ability using interrupt_main.
So I'm planning to test this idea, if you don't try it before me.