mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
minor fixes
This commit is contained in:
parent
3636ed7d41
commit
83102b853f
@ -61,13 +61,13 @@ def scriptenv(path, args):
|
|||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
except Exception:
|
except Exception:
|
||||||
_, _, tb = sys.exc_info()
|
etype, value, tb = sys.exc_info()
|
||||||
scriptdir = os.path.dirname(os.path.abspath(path))
|
scriptdir = os.path.dirname(os.path.abspath(path))
|
||||||
for i, s in enumerate(reversed(traceback.extract_tb(tb))):
|
for i, s in enumerate(reversed(traceback.extract_tb(tb))):
|
||||||
tb = tb.tb_next
|
tb = tb.tb_next
|
||||||
if not os.path.abspath(s[0]).startswith(scriptdir):
|
if not os.path.abspath(s[0]).startswith(scriptdir):
|
||||||
break
|
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:
|
finally:
|
||||||
sys.argv = oldargs
|
sys.argv = oldargs
|
||||||
sys.path.pop()
|
sys.path.pop()
|
||||||
|
@ -92,6 +92,7 @@ def mitmdump(args=None): # pragma: no cover
|
|||||||
if args.quiet:
|
if args.quiet:
|
||||||
args.flow_detail = 0
|
args.flow_detail = 0
|
||||||
|
|
||||||
|
master = None
|
||||||
try:
|
try:
|
||||||
dump_options = dump.Options(**cmdline.get_common_options(args))
|
dump_options = dump.Options(**cmdline.get_common_options(args))
|
||||||
dump_options.flow_detail = args.flow_detail
|
dump_options.flow_detail = args.flow_detail
|
||||||
@ -110,7 +111,7 @@ def mitmdump(args=None): # pragma: no cover
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except (KeyboardInterrupt, _thread.error):
|
except (KeyboardInterrupt, _thread.error):
|
||||||
pass
|
pass
|
||||||
if master.has_errored:
|
if master is None or master.has_errored:
|
||||||
print("mitmdump: errors occurred during run", file=sys.stderr)
|
print("mitmdump: errors occurred during run", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user