diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-01-10 10:36:06 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-01-10 10:37:28 +0100 |
commit | d953d83773af24341f961f3c003433b8a5006810 (patch) | |
tree | 8051ec492b5cdb8597fe46743f277b8ecc057eff /mitmproxy/master.py | |
parent | 88f3459c7d7fc44bf0e247cf7f018f8c53431e8d (diff) | |
download | mitmproxy-d953d83773af24341f961f3c003433b8a5006810.tar.gz mitmproxy-d953d83773af24341f961f3c003433b8a5006810.tar.bz2 mitmproxy-d953d83773af24341f961f3c003433b8a5006810.zip |
mitmdump: fix reading from stdin
Diffstat (limited to 'mitmproxy/master.py')
-rw-r--r-- | mitmproxy/master.py | 7 |
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: |