mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
minor fixes
This commit is contained in:
parent
3636ed7d41
commit
83102b853f
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user