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.
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
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32