From 20a3700a2c5e83f8011ff3788919c764d87a03ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 6 Jul 2020 21:49:18 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20busy=20loop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3633 --- src/octoprint/util/comm.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index dd4277ea1..47456b331 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -5025,7 +5025,7 @@ class BufferedReadlineWrapper(wrapt.ObjectProxy): timeout = serial.Timeout(self._timeout) while not timeout.expired(): - self._buffered += self.read(min(self.in_waiting, 1)) + self._buffered += self.read(self.in_waiting) # check for terminator, if it's there we have found our line termpos = self._buffered.find(terminator) @@ -5035,6 +5035,16 @@ class BufferedReadlineWrapper(wrapt.ObjectProxy): del self._buffered[:termpos + termlen] return bytes(line) + if timeout.expired(): + break + + c = self.read(1) + if not c: + # EOF + break + + self._buffered += c + return b""