From a0122e97a70d200457da210b9a75b4f1a4896ca7 Mon Sep 17 00:00:00 2001 From: passer Date: Thu, 10 Jun 2021 23:03:24 +0800 Subject: [PATCH] Fix blocking of pty_read when there isn't pty data ready to read --- terminado/management.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terminado/management.py b/terminado/management.py index 5895b49..f59e154 100644 --- a/terminado/management.py +++ b/terminado/management.py @@ -14,6 +14,7 @@ import signal import codecs import warnings +import select try: from ptyprocess import PtyProcessUnicode @@ -205,6 +206,9 @@ def on_eof(self, ptywclients): def pty_read(self, fd, events=None): """Called by the event loop when there is pty data ready to read.""" + r, _, _ = select.select([fd], [], [], .1) + if not r: + return ptywclients = self.ptys_by_fd[fd] try: s = ptywclients.ptyproc.read(65536)