minor fixes

This commit is contained in:
Maximilian Hils 2016-07-27 19:38:36 -07:00
parent 3636ed7d41
commit 83102b853f
2 changed files with 4 additions and 3 deletions

View File

@ -61,13 +61,13 @@ def scriptenv(path, args):
try:
yield
except Exception:
_, _, tb = sys.exc_info()
etype, value, tb = sys.exc_info()
scriptdir = os.path.dirname(os.path.abspath(path))
for i, s in enumerate(reversed(traceback.extract_tb(tb))):
tb = tb.tb_next
if not os.path.abspath(s[0]).startswith(scriptdir):
break
ctx.log.error("Script error: %s" % "".join(traceback.format_tb(tb)))
ctx.log.error("Script error: %s" % "".join(traceback.format_exception(etype, value, tb)))
finally:
sys.argv = oldargs
sys.path.pop()

View File

@ -92,6 +92,7 @@ def mitmdump(args=None): # pragma: no cover
if args.quiet:
args.flow_detail = 0
master = None
try:
dump_options = dump.Options(**cmdline.get_common_options(args))
dump_options.flow_detail = args.flow_detail
@ -110,7 +111,7 @@ def mitmdump(args=None): # pragma: no cover
sys.exit(1)
except (KeyboardInterrupt, _thread.error):
pass
if master.has_errored:
if master is None or master.has_errored:
print("mitmdump: errors occurred during run", file=sys.stderr)
sys.exit(1)