mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
open flow files using with as max suggested
This commit is contained in:
parent
c4aeca2764
commit
4f578866fa
@ -501,8 +501,8 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
flows = []
|
||||
for path in paths:
|
||||
path = os.path.expanduser(path)
|
||||
f = file(path, "rb")
|
||||
flows.extend(list(flow.FlowReader(f).stream()))
|
||||
with file(path, "rb") as f:
|
||||
flows.extend(list(flow.FlowReader(f).stream()))
|
||||
except (IOError, flow.FlowReadError), v:
|
||||
return True, v.strerror
|
||||
return False, flows
|
||||
|
@ -148,8 +148,8 @@ class DumpMaster(flow.FlowMaster):
|
||||
flows = []
|
||||
for path in paths:
|
||||
path = os.path.expanduser(path)
|
||||
f = file(path, "rb")
|
||||
flows.extend(list(flow.FlowReader(f).stream()))
|
||||
with file(path, "rb") as f:
|
||||
flows.extend(list(flow.FlowReader(f).stream()))
|
||||
except (IOError, flow.FlowReadError), v:
|
||||
raise DumpError(v.strerror)
|
||||
return flows
|
||||
|
Loading…
Reference in New Issue
Block a user