[PATCH 1/2] tester: Simplify the console data handling

chrisj at rtems.org chrisj at rtems.org
Tue Sep 14 07:21:44 UTC 2021


From: Chris Johns <chrisj at rtems.org>

---
 tester/rt/console.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/tester/rt/console.py b/tester/rt/console.py
index 7e09bb9..13300da 100644
--- a/tester/rt/console.py
+++ b/tester/rt/console.py
@@ -109,7 +109,6 @@ class tty(console):
                     data = me.tty.read()
                     if isinstance(data, bytes):
                         data = data.decode('utf-8', 'ignore')
-                    data = [c for c in data if ord(c) < 128]
                 except IOError as ioe:
                     if ioe.errno == errno.EAGAIN:
                         continue
@@ -117,13 +116,11 @@ class tty(console):
                 except:
                     raise
                 for c in data:
-                    if len(c) == 0:
-                        continue
-                    if c != chr(0):
+                    if ord(c) > 0 and ord(c) < 128:
                         line += c
-                    if c == '\n':
-                        me.output(line)
-                        line = ''
+                        if c == '\n':
+                            me.output(line)
+                            line = ''
         if stty and path.exists(self.dev):
             self.tty = stty.tty(self.dev)
         else:
-- 
2.24.1



More information about the devel mailing list