mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
check tty after options parsing
This commit is contained in:
parent
fd63386593
commit
0c91503b97
@ -481,6 +481,12 @@ class ConsoleMaster(master.Master):
|
|||||||
|
|
||||||
def __init__(self, options, server):
|
def __init__(self, options, server):
|
||||||
super().__init__(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.view = view.View() # type: view.View
|
||||||
self.stream_path = None
|
self.stream_path = None
|
||||||
# This line is just for type hinting
|
# This line is just for type hinting
|
||||||
|
@ -112,11 +112,6 @@ def mitmproxy(args=None): # pragma: no cover
|
|||||||
"You can run mitmdump or mitmweb instead.", file=sys.stderr)
|
"You can run mitmdump or mitmweb instead.", file=sys.stderr)
|
||||||
sys.exit(1)
|
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()
|
assert_utf8_env()
|
||||||
|
|
||||||
from mitmproxy.tools import console
|
from mitmproxy.tools import console
|
||||||
|
Loading…
Reference in New Issue
Block a user