Signal handler & cygwin

Discussion in 'Python' started by gervaz, Dec 26, 2010.

  1. gervaz

    gervaz Guest

    Hi all, given the followin code snippet:

    import signal
    import time
    import sys
    import os

    print("{0}\n".format(os.getpid()))

    ContinueProcessing = True

    def stop(signal, frame):
    print("\nSignal received!\n")
    time.sleep(1)
    global ContinueProcessing
    ContinueProcessing = False

    signal.signal(signal.SIGINT, stop)

    while ContinueProcessing:
    try:
    sys.stdout.write(".")
    sys.stdout.flush()
    time.sleep(0.1)
    except:
    continue

    if I kill the process using kill -s SIGINT PID in linux everything
    works fine and the signal is correctly handled, while in win, using
    cywin (/bin/kill.exe -f -s SIGINT WINPID), the program just exits
    without trapping the interrupt.

    Any similar experience?
     
    gervaz, Dec 26, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    517
  2. Replies:
    0
    Views:
    459
  3. WELCOME to

    , Sep 3, 2003, in forum: Python
    Replies:
    1
    Views:
    537
    Robin Becker
    Sep 5, 2003
  4. Replies:
    0
    Views:
    423
  5. Michael Pronath
    Replies:
    1
    Views:
    1,236
    Diez B. Roggisch
    Jan 3, 2005
Loading...

Share This Page