From 37530ccdd15f73466f4c630ca9e101adc4ee0a0a Mon Sep 17 00:00:00 2001 From: psy Date: Sun, 22 Sep 2013 06:12:49 -0700 Subject: [PATCH] thread liberation after KeyboardInterrupt on main --- main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 0d765ff..55767f1 100755 --- a/main.py +++ b/main.py @@ -507,11 +507,12 @@ class bc(object): # start web mode (on a different thread) try: t = threading.Thread(target=BorderCheckWebserver, args=(self, )) + t.daemon = True t.start() time.sleep(2) - except: - print "Error: unable to start thread" - pass + except (KeyboardInterrupt, SystemExit): + t.join() + sys.exit() # open same browser of history access on a new tab try: webbrowser.open('http://127.0.0.1:8080', new=1) @@ -537,6 +538,8 @@ class bc(object): open('data.xml', 'w') # starting a new xml data container in write mode traces = self.try_running(self.traces, "\nInternal error tracerouting.") time.sleep(2) + #if KeyboardInterrupt: + # break if __name__ == "__main__": app = bc()