Hi Tim,

Am 13.11.2012 um 21:44 schrieb Tim Golden <m...@timgolden.me.uk>:

> On 12/11/2012 13:12, Stefan Scherfke wrote:
>> Hi all,
>> 
>> recently I’ve been playing around with sending and catching signals on
>> Windows. I finally found out how to send and catch a BREAK event.
>> 
>> With Python 2.7(.2), I only need os.kill(pid, signal.CTRL_C_EVENT) and
>> signal.signal(signal.SIGBREAK, handler). Alternatively, I can use
>> GenerateConsoleCtrlEvent and SetConsoleCtrlHandler via ctypes.
>> 
>> However, the former does not work with Python 3.3 (64bit) and the latter
>> always raises a KeyError in Python’s threading module.
>> 
>> My question is: Should signal.signal(signal.SIGBREAK, handler) work
>> under Python 3.3? If so, what am I doing wrong? Why raises the
>> ctypes-variant an error while the signal-variant doesn’t?
> 
> Possibly unhelpfully, I've just run your code on Python 2.7, 3.3 and 3.4, all 
> of which gave the same output:
> 
> parent waiting for child
> child terminating
> parent terminating
> 
> This is on WinXP SP3.

did you get this output immediately (within 1 or 2 seconds) or after a while?
The child terminates on its own after 10 seconds, but it shouldn’t get there.

Cheers,
Stefan

> 
> That said, there has been quite a bit of activity around the handling of 
> Ctrl-C / Ctrl-Break and KeyboardInterrupt around 3.2 so it wouldn't surprise 
> me if something has changed there.
> 
> TJG

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to