Skip to content

Commit

Permalink
Avoid triggering an exception when shutting down the line editor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ronf committed Aug 30, 2023
1 parent e755778 commit 777d328
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions asyncssh/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,8 +704,10 @@ def process_input(self, data: str, datatype: DataType) -> None:
self._ring_bell()

self._bell_rung = False
self._chan.write(''.join(self._outbuf))
self._outbuf.clear()

if self._outbuf:
self._chan.write(''.join(self._outbuf))
self._outbuf.clear()
else:
self._session.data_received(data, datatype)

Expand Down

0 comments on commit 777d328

Please sign in to comment.