summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-04-03 13:32:53 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-04-03 13:32:53 +0200
commit647f46102873af704a84826620698ad4e9be127e (patch)
tree2ba263a72414679fc1b7a3f1704efdfe392ea530 /lib
parentca4aa52f635ba46caf8927591ad13cd4bcbb1fc7 (diff)
runner: handle all sorts of newline types
Diffstat (limited to 'lib')
-rw-r--r--lib/runner.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/runner.py b/lib/runner.py
index c9179c2..19b88f3 100644
--- a/lib/runner.py
+++ b/lib/runner.py
@@ -39,12 +39,7 @@ class SerialReader(serial.threaded.Protocol):
str_data = data.decode('UTF-8')
self.recv_buf += str_data
- if '\n\r' in self.recv_buf:
- lines = self.recv_buf.split('\n\r')
- elif '\r\n' in self.recv_buf:
- lines = self.recv_buf.split('\r\n')
- else:
- lines = []
+ lines = list(map(str.strip, self.recv_buf.split('\n')))
if len(lines) > 1:
self.lines.extend(lines[:-1])
self.recv_buf = lines[-1]