commit | 6f03c0b657fa229ee55e6c8e83d6291b1119170e | [log] [tgz] |
---|---|---|
author | Chris Liechti <cliechti@gmx.net> | Thu Dec 22 23:51:34 2016 +0100 |
committer | Chris Liechti <cliechti@gmx.net> | Thu Dec 22 23:51:34 2016 +0100 |
tree | 3c3920aaa5970c64dd9267a18a467e0280b5d8df | |
parent | 129aca62297bc3f2d8fa962ce41017225466a1cf [diff] |
serialutil: add overall timeout for read_until see #182
diff --git a/serial/serialutil.py b/serial/serialutil.py index 636a10c..872080d 100644 --- a/serial/serialutil.py +++ b/serial/serialutil.py
@@ -636,6 +636,7 @@ """ lenterm = len(terminator) line = bytearray() + timeout = Timeout(self._timeout) while True: c = self.read(1) if c: @@ -646,6 +647,8 @@ break else: break + if timeout.expired(): + break return bytes(line) def iread_until(self, *args, **kwargs):