diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 07488d7ed..a568d2b6c 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -460,16 +460,6 @@ class Application(QApplication): """ # pylint: disable=broad-except - if exctype is bdb.BdbQuit or not issubclass(exctype, Exception): - # pdb exit, KeyboardInterrupt, ... - try: - self.shutdown() - return - except Exception: - log.init.exception("Error while shutting down") - self.quit() - return - exc = (exctype, excvalue, tb) if not self._quit_status['crash']: @@ -478,6 +468,21 @@ class Application(QApplication): return log.misc.error("Uncaught exception", exc_info=exc) + + is_ignored_exception = (exctype is bdb.BdbQuit or + not issubclass(exctype, Exception)) + + if is_ignored_exception or self._args.no_crash_dialog: + # pdb exit, KeyboardInterrupt, ... + status = 0 if is_ignored_exception else 2 + try: + self.shutdown(status) + return + except Exception: + log.init.exception("Error while shutting down") + self.quit() + return + self._quit_status['crash'] = False try: diff --git a/qutebrowser/qutebrowser.py b/qutebrowser/qutebrowser.py index 8c69829b9..87a7d3635 100644 --- a/qutebrowser/qutebrowser.py +++ b/qutebrowser/qutebrowser.py @@ -70,6 +70,8 @@ def get_argparser(): "the main window.") debug.add_argument('--debug-exit', help="Turn on debugging of late exit.", action='store_true') + debug.add_argument('--no-crash-dialog', action='store_true', help="Don't " + "show a crash dialog.") # For the Qt args, we use store_const with const=True rather than # store_true because we want the default to be None, to make # utils.qt:get_args easier.