Merge commit 'f31aead992e829cb15c4fbedbf816a23d2a916a7' into jswz72/master
This commit is contained in:
commit
b966034250
@ -792,7 +792,7 @@ class Application(QApplication):
|
|||||||
def exit(self, status):
|
def exit(self, status):
|
||||||
"""Extend QApplication::exit to log the event."""
|
"""Extend QApplication::exit to log the event."""
|
||||||
log.destroy.debug("Now calling QApplication::exit.")
|
log.destroy.debug("Now calling QApplication::exit.")
|
||||||
if self._args.debug_exit:
|
if 'debug-exit' in self._args.debug_flags:
|
||||||
if hunter is None:
|
if hunter is None:
|
||||||
print("Not logging late shutdown because hunter could not be "
|
print("Not logging late shutdown because hunter could not be "
|
||||||
"imported!", file=sys.stderr)
|
"imported!", file=sys.stderr)
|
||||||
|
@ -207,10 +207,10 @@ class CrashHandler(QObject):
|
|||||||
is_ignored_exception = (exctype is bdb.BdbQuit or
|
is_ignored_exception = (exctype is bdb.BdbQuit or
|
||||||
not issubclass(exctype, Exception))
|
not issubclass(exctype, Exception))
|
||||||
|
|
||||||
if self._args.pdb_postmortem:
|
if 'pdb-postmortem' in self._args.debug_flags:
|
||||||
pdb.post_mortem(tb)
|
pdb.post_mortem(tb)
|
||||||
|
|
||||||
if is_ignored_exception or self._args.pdb_postmortem:
|
if is_ignored_exception or 'pdb-postmortem' in self._args.debug_flags:
|
||||||
# pdb exit, KeyboardInterrupt, ...
|
# pdb exit, KeyboardInterrupt, ...
|
||||||
status = 0 if is_ignored_exception else 2
|
status = 0 if is_ignored_exception else 2
|
||||||
try:
|
try:
|
||||||
|
@ -103,10 +103,6 @@ def get_argparser():
|
|||||||
help="Silently remove unknown config options.")
|
help="Silently remove unknown config options.")
|
||||||
debug.add_argument('--nowindow', action='store_true', help="Don't show "
|
debug.add_argument('--nowindow', action='store_true', help="Don't show "
|
||||||
"the main window.")
|
"the main window.")
|
||||||
debug.add_argument('--debug-exit', help="Turn on debugging of late exit.",
|
|
||||||
action='store_true')
|
|
||||||
debug.add_argument('--pdb-postmortem', action='store_true',
|
|
||||||
help="Drop into pdb on exceptions.")
|
|
||||||
debug.add_argument('--temp-basedir', action='store_true', help="Use a "
|
debug.add_argument('--temp-basedir', action='store_true', help="Use a "
|
||||||
"temporary basedir.")
|
"temporary basedir.")
|
||||||
debug.add_argument('--no-err-windows', action='store_true', help="Don't "
|
debug.add_argument('--no-err-windows', action='store_true', help="Don't "
|
||||||
@ -118,6 +114,9 @@ def get_argparser():
|
|||||||
action='append')
|
action='append')
|
||||||
debug.add_argument('--qt-flag', help="Pass an argument to Qt as flag.",
|
debug.add_argument('--qt-flag', help="Pass an argument to Qt as flag.",
|
||||||
nargs=1, action='append')
|
nargs=1, action='append')
|
||||||
|
debug.add_argument('--debug-flag', type=debug_flag_error, default=[],
|
||||||
|
help="Pass name of debugging feature to be turned on.",
|
||||||
|
nargs=1, action='append', dest='debug_flags')
|
||||||
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
||||||
"startup.", metavar=':command')
|
"startup.", metavar=':command')
|
||||||
# URLs will actually be in command
|
# URLs will actually be in command
|
||||||
@ -145,6 +144,22 @@ def logfilter_error(logfilter: str):
|
|||||||
logfilter, ', '.join(log.LOGGER_NAMES)))
|
logfilter, ', '.join(log.LOGGER_NAMES)))
|
||||||
|
|
||||||
|
|
||||||
|
def debug_flag_error(flag):
|
||||||
|
"""Validate flags passed to --debug-flag.
|
||||||
|
|
||||||
|
Available flags:
|
||||||
|
debug-exit: Turn on debugging of late exit.
|
||||||
|
pdb-postmortem: Drop into pdb on exceptions.
|
||||||
|
"""
|
||||||
|
valid_flags = ['debug-exit', 'pdb-postmortem']
|
||||||
|
|
||||||
|
if flag in valid_flags:
|
||||||
|
return flag
|
||||||
|
else:
|
||||||
|
raise argparse.ArgumentTypeError("Invalid flag - valid flags include: " +
|
||||||
|
str(valid_flags))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = get_argparser()
|
parser = get_argparser()
|
||||||
if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
|
if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
|
||||||
|
Loading…
Reference in New Issue
Block a user