154eb9cb113d

Handle Ctrl+C cleanly.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 24 Nov 2012 13:48:39 -0500
parents 6ee9f82b2d71
children 0e92c9363422
branches/tags (none)
files peat

Changes

--- a/peat	Sat Nov 17 12:11:15 2012 -0500
+++ b/peat	Sat Nov 24 13:48:39 2012 -0500
@@ -154,5 +154,10 @@
 
 
 if __name__ == '__main__':
+    import signal
+    def sigint_handler(signal, frame):
+        sys.stdout.write('\n')
+        sys.exit(130)
+    signal.signal(signal.SIGINT, sigint_handler)
     main()