[pony-build] Python Signals in Windows

Rosangela Canino-Koning voidptr at gmail.com
Mon Mar 22 19:11:58 PDT 2010


Looks like signaling functionality under Windows is extremely limited. None
of the alarm functions are available.

This script redefines SIGINT (ctrl-C keyboard interrupt under windows) and
keeps looping.

import signal, os, time

def handler(signum, frame):
    print 'You raised a SigInt! Signal handler called with signal', signum
    #print 'Quitting now.'
    #os.abort();

signal.signal(signal.SIGINT, handler)

while True:
    print 'Loop in...'
    time.sleep(1)
    print '3'
    time.sleep(1)
    print '2'
    time.sleep(1)
    print '1'
    time.sleep(1)

To trigger it, run the script under Windows, and then hit ctrl-c to raise
the signal.

Here's the definitive doc I found that lists what's available where:
http://docs.python.org/library/signal.html

-r
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/pony-build/attachments/20100322/f9a51771/attachment.htm>


More information about the pony-build mailing list