Permalink
Browse files

handling ctrl+c

  • Loading branch information...
1 parent e14afdb commit d486dcb83335b09e8b416512319be60e3a49e3f2 @outofjungle committed Feb 8, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 rpi/bin/sync2serial
View
9 rpi/bin/sync2serial
@@ -7,6 +7,14 @@ import argparse
import logging
import os
import time
+import signal
+import sys
+
+def exit_handler(signal, frame):
+ print 'You pressed Ctrl+C!'
+ sys.exit(0)
+
+signal.signal(signal.SIGINT, exit_handler)
def checksum(sentence):
@@ -16,7 +24,6 @@ def checksum(sentence):
return checksum
-
if __name__ == '__main__':
parser = argparse.ArgumentParser(

0 comments on commit d486dcb

Please sign in to comment.