Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Signal handler & cygwin (http://www.velocityreviews.com/forums/t740858-signal-handler-and-cygwin.html)

gervaz 12-26-2010 01:46 AM

Signal handler & cygwin
 
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?


All times are GMT. The time now is 01:56 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.