Skip to content

Instantly share code, notes, and snippets.

View Royhb's full-sized avatar

Roy Barkas Royhb

  • OceanTrack
  • Hobart, Tasmania Australia
View GitHub Profile
@Royhb
Royhb / gist:ce3972ef07cc3a619b23
Last active August 29, 2015 14:02
websocketd exiting a persistent program
import signal
from sys import stdin, stdout
import time
def clean_exit():
# do whatever is required to clean up, then
exit()
if __name__ == "__main__":
signal.signal(signal.SIGINT, clean_exit)