aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-01-10 10:58:18 +0100
committerGitHub <noreply@github.com>2017-01-10 10:58:18 +0100
commit48e399a2854bc9e3ef89c87cfd7adbddff9b0dea (patch)
tree0bcbc2c990b785946935a2359b99c3d14db39335
parent9c133abc7902423f74f74419f771f5d98ac1bcb0 (diff)
parentd953d83773af24341f961f3c003433b8a5006810 (diff)
downloadmitmproxy-48e399a2854bc9e3ef89c87cfd7adbddff9b0dea.tar.gz
mitmproxy-48e399a2854bc9e3ef89c87cfd7adbddff9b0dea.tar.bz2
mitmproxy-48e399a2854bc9e3ef89c87cfd7adbddff9b0dea.zip
Merge pull request #1922 from mhils/read-from-stdin
mitmdump: fix reading from stdin
-rw-r--r--mitmproxy/master.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mitmproxy/master.py b/mitmproxy/master.py
index 7581d816..ee240eeb 100644
--- a/mitmproxy/master.py
+++ b/mitmproxy/master.py
@@ -170,8 +170,11 @@ class Master:
path = os.path.expanduser(path)
try:
if path == "-":
- # This is incompatible with Python 3 - maybe we can use click?
- freader = io.FlowReader(sys.stdin)
+ try:
+ 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)
else:
with open(path, "rb") as f: