Signal handler & cygwin

G

gervaz

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top