Catch Ctrl+C / SIGINT and exit multiprocesses gracefully in python

How do I catch a Ctrl+C in multiprocess python program and exit all processes gracefully, I need the solution to work both on unix and windows. I’ve tried the following: import multiprocessing import time import signal import sys jobs = [] def worker(): signal.signal(signal.SIGINT, signal_handler) while(True): time.sleep(1.1234) print "Working…" def signal_handler(signal, frame): print 'You pressed … Read more