99
1010from prompt_toolkit .application .current import AppSession , create_app_session
1111from prompt_toolkit .data_structures import Size
12- from prompt_toolkit .input . posix_pipe import PosixPipeInput
12+ from prompt_toolkit .input import create_pipe_input
1313from prompt_toolkit .output .vt100 import Vt100_Output
1414
1515__all__ = [
@@ -27,7 +27,8 @@ def __init__(self, interact: Callable[[], Awaitable[None]]) -> None:
2727 # PipInput object, for sending input in the CLI.
2828 # (This is something that we can use in the prompt_toolkit event loop,
2929 # but still write date in manually.)
30- self ._input = PosixPipeInput ()
30+ self ._input = create_pipe_input ()
31+ self ._output = None
3132
3233 # Output object. Don't render to the real stdout, but write everything
3334 # in the SSH channel.
@@ -39,9 +40,7 @@ def write(s, data):
3940 def flush (s ):
4041 pass
4142
42- self ._output = Vt100_Output (
43- cast (TextIO , Stdout ()), self ._get_size , write_binary = False
44- )
43+ self .stdout = cast (TextIO , Stdout ())
4544
4645 def _get_size (self ) -> Size :
4746 """
@@ -70,7 +69,11 @@ async def _interact(self) -> None:
7069 # Disable the line editing provided by asyncssh. Prompt_toolkit
7170 # provides the line editing.
7271 self ._chan .set_line_mode (False )
72+ term = self ._chan .get_terminal_type ()
7373
74+ self ._output = Vt100_Output (
75+ self .stdout , self ._get_size , term = term , write_binary = False
76+ )
7477 with create_app_session (input = self ._input , output = self ._output ) as session :
7578 self .app_session = session
7679 try :
0 commit comments