aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/tools/console/master.py6
-rw-r--r--mitmproxy/tools/main.py5
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