diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-06-04 14:34:28 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2017-06-04 14:34:28 +0200 |
commit | 0c91503b975e627f4115b05577b62f4a44900e31 (patch) | |
tree | b0ffdcbc271b82747639e0b16c5773690b9922e8 | |
parent | fd633865937e596a647c1ad39a30d88b10a766c3 (diff) | |
download | mitmproxy-0c91503b975e627f4115b05577b62f4a44900e31.tar.gz mitmproxy-0c91503b975e627f4115b05577b62f4a44900e31.tar.bz2 mitmproxy-0c91503b975e627f4115b05577b62f4a44900e31.zip |
check tty after options parsing
-rw-r--r-- | mitmproxy/tools/console/master.py | 6 | ||||
-rw-r--r-- | mitmproxy/tools/main.py | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/mitmproxy/tools/console/master.py b/mitmproxy/tools/console/master.py index d1d470e1..998d452d 100644 --- a/mitmproxy/tools/console/master.py +++ b/mitmproxy/tools/console/master.py @@ -481,6 +481,12 @@ class ConsoleMaster(master.Master): def __init__(self, options, server): super().__init__(options, server) + + if not sys.stdout.isatty(): + print("Error: mitmproxy's console interface requires a tty. " + "Please run mitmproxy in an interactive shell environment.", file=sys.stderr) + sys.exit(1) + self.view = view.View() # type: view.View self.stream_path = None # This line is just for type hinting diff --git a/mitmproxy/tools/main.py b/mitmproxy/tools/main.py index 6ac8a261..7debb3e0 100644 --- a/mitmproxy/tools/main.py +++ b/mitmproxy/tools/main.py @@ -112,11 +112,6 @@ def mitmproxy(args=None): # pragma: no cover "You can run mitmdump or mitmweb instead.", file=sys.stderr) sys.exit(1) - if not sys.stdout.isatty(): - print("Error: mitmproxy's console interface requires a tty. " - "Please run mitmproxy in an interactive shell environment.", file=sys.stderr) - sys.exit(1) - assert_utf8_env() from mitmproxy.tools import console |