Merge pull request #2339 from bauerj/error-window
Semi-automated crash reporting
This commit is contained in:
26
lib/util.py
26
lib/util.py
@@ -707,3 +707,29 @@ class QueuePipe:
|
||||
self.send(request)
|
||||
|
||||
|
||||
|
||||
|
||||
def setup_thread_excepthook():
|
||||
"""
|
||||
Workaround for `sys.excepthook` thread bug from:
|
||||
http://bugs.python.org/issue1230540
|
||||
|
||||
Call once from the main thread before creating any threads.
|
||||
"""
|
||||
|
||||
init_original = threading.Thread.__init__
|
||||
|
||||
def init(self, *args, **kwargs):
|
||||
|
||||
init_original(self, *args, **kwargs)
|
||||
run_original = self.run
|
||||
|
||||
def run_with_except_hook(*args2, **kwargs2):
|
||||
try:
|
||||
run_original(*args2, **kwargs2)
|
||||
except Exception:
|
||||
sys.excepthook(*sys.exc_info())
|
||||
|
||||
self.run = run_with_except_hook
|
||||
|
||||
threading.Thread.__init__ = init
|
||||
Reference in New Issue
Block a user