Skip to content

Commit

Permalink
Handle BrokenPipeError in SSH server.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanslenders committed Aug 23, 2020
1 parent cacbdf8 commit 67d44cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions prompt_toolkit/contrib/ssh/server.py
Expand Up @@ -34,8 +34,11 @@ def __init__(
# in the SSH channel.
class Stdout:
def write(s, data):
if self._chan is not None:
self._chan.write(data.replace("\n", "\r\n"))
try:
if self._chan is not None:
self._chan.write(data.replace("\n", "\r\n"))
except BrokenPipeError:
pass # Channel not open for sending.

def flush(s):
pass
Expand Down

0 comments on commit 67d44cc

Please sign in to comment.