From 6db1f8e3e3109d0f2ad6c0cfc06b858571e280ec Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 Jun 2018 08:36:47 +0530 Subject: [PATCH] Dont read more data than needed in TTYIO --- kitty/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kitty/utils.py b/kitty/utils.py index 335f63447..b35e69c97 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -382,8 +382,7 @@ class TTYIO: for chunk in data: write_all(self.tty_fd, chunk) - def recv(self, more_needed, timeout): - from io import DEFAULT_BUFFER_SIZE + def recv(self, more_needed, timeout, sz=1): import select fd = self.tty_fd start_time = monotonic() @@ -391,7 +390,7 @@ class TTYIO: rd = select.select([fd], [], [], max(0, timeout - (monotonic() - start_time)))[0] if not rd: break - data = os.read(fd, DEFAULT_BUFFER_SIZE) + data = os.read(fd, sz) if not data: break # eof if not more_needed(data):