Skip to content

Commit 777d328

Browse files
committed
Avoid triggering an exception when shutting down the line editor
This commit avoids triggering an internal exception when shutting down the line editor which can lead to data loss on exit, especially on Windows. Thanks go to GitHub user jerrbe for reporting this issue.
1 parent e755778 commit 777d328

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

asyncssh/editor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,10 @@ def process_input(self, data: str, datatype: DataType) -> None:
704704
self._ring_bell()
705705

706706
self._bell_rung = False
707-
self._chan.write(''.join(self._outbuf))
708-
self._outbuf.clear()
707+
708+
if self._outbuf:
709+
self._chan.write(''.join(self._outbuf))
710+
self._outbuf.clear()
709711
else:
710712
self._session.data_received(data, datatype)
711713

0 commit comments

Comments
 (0)