diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-11-06 11:35:54 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-11-06 11:35:54 +1300 |
commit | 6135e16482b5962d1b5019666b0db1cbb2881333 (patch) | |
tree | 0ee6888a0e7620ae703022609e178325710b2006 /libmproxy | |
parent | de5df2e4d4ec253a9ffbc0dffd8ce69d035383e9 (diff) | |
download | mitmproxy-6135e16482b5962d1b5019666b0db1cbb2881333.tar.gz mitmproxy-6135e16482b5962d1b5019666b0db1cbb2881333.tar.bz2 mitmproxy-6135e16482b5962d1b5019666b0db1cbb2881333.zip |
Catch and ignore thread errors on exit
Keyboard interrupts bugger up Queues in some way, which causes a traceback on
exit in many of our tools. The issue seems easiest to reproduce with binary
builds on OSX.
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/main.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libmproxy/main.py b/libmproxy/main.py index 23cb487c..3c908ed9 100644 --- a/libmproxy/main.py +++ b/libmproxy/main.py @@ -2,6 +2,7 @@ from __future__ import print_function, absolute_import import os import signal import sys +import thread from netlib.version_check import check_pyopenssl_version, check_mitmproxy_version from . import version, cmdline from .exceptions import ServerException @@ -62,7 +63,7 @@ def mitmproxy(args=None): # pragma: nocover m = console.ConsoleMaster(server, console_options) try: m.run() - except KeyboardInterrupt: + except (KeyboardInterrupt, thread.error): pass @@ -97,7 +98,7 @@ def mitmdump(args=None): # pragma: nocover except dump.DumpError as e: print("mitmdump: %s" % e, file=sys.stderr) sys.exit(1) - except KeyboardInterrupt: + except (KeyboardInterrupt, thread.error): pass @@ -125,5 +126,5 @@ def mitmweb(args=None): # pragma: nocover m = web.WebMaster(server, web_options) try: m.run() - except KeyboardInterrupt: + except (KeyboardInterrupt, thread.error): pass |