Skip to content

Commit 2abbf7d

Browse files
JoshHeitzmanjonathanslenders
authored andcommitted
Fix for ssh serving issues:
#1207 #1209
1 parent 75f2390 commit 2abbf7d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

prompt_toolkit/contrib/ssh/server.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def write(s, data):
3939
def flush(s):
4040
pass
4141

42+
@property
43+
def encoding(s):
44+
return self._chan._orig_chan.get_encoding()[0]
45+
4246
self.stdout = cast(TextIO, Stdout())
4347

4448
def _get_size(self) -> Size:
@@ -65,9 +69,11 @@ async def _interact(self) -> None:
6569
# Should not happen.
6670
raise Exception("`_interact` called before `connection_made`.")
6771

68-
# Disable the line editing provided by asyncssh. Prompt_toolkit
69-
# provides the line editing.
70-
self._chan.set_line_mode(False)
72+
if hasattr(self._chan, 'set_line_mode') and self._chan._editor is not None:
73+
# Disable the line editing provided by asyncssh. Prompt_toolkit
74+
# provides the line editing.
75+
self._chan.set_line_mode(False)
76+
7177
term = self._chan.get_terminal_type()
7278

7379
self._output = Vt100_Output(

0 commit comments

Comments
 (0)