mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 11:03:13 +00:00
Merge pull request #1922 from mhils/read-from-stdin
mitmdump: fix reading from stdin
This commit is contained in:
commit
48e399a285
@ -170,8 +170,11 @@ class Master:
|
|||||||
path = os.path.expanduser(path)
|
path = os.path.expanduser(path)
|
||||||
try:
|
try:
|
||||||
if path == "-":
|
if path == "-":
|
||||||
# This is incompatible with Python 3 - maybe we can use click?
|
try:
|
||||||
freader = io.FlowReader(sys.stdin)
|
sys.stdin.buffer.read(0)
|
||||||
|
except Exception as e:
|
||||||
|
raise IOError("Cannot read from stdin: {}".format(e))
|
||||||
|
freader = io.FlowReader(sys.stdin.buffer)
|
||||||
return self.load_flows(freader)
|
return self.load_flows(freader)
|
||||||
else:
|
else:
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user