diff options
author | Tom Rini <trini@konsulko.com> | 2019-11-01 09:23:21 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-11-01 09:23:21 -0400 |
commit | 82679624f9aa6d1be733c46f3555d5166b6f5b72 (patch) | |
tree | 8a99cf79bc520b833e155094ef134c0526b1f005 /test/py/u_boot_spawn.py | |
parent | 412326d1bc2d346d7b4faad6fa547eaf065681a2 (diff) | |
parent | 5d80a1a93d42c8325d65516cc654ff6a9ceec58a (diff) |
Merge branch '2019-10-30-master-imports'
- Migrate test.py to use python3 and current pytest.
- NVMe bugfixes
- Assorted other fixes
- Android AVB updates.
Diffstat (limited to 'test/py/u_boot_spawn.py')
-rw-r--r-- | test/py/u_boot_spawn.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index b011a3e3da2..6991b78cca8 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -42,10 +42,7 @@ class Spawn(object): self.after = '' self.timeout = None # http://stackoverflow.com/questions/7857352/python-regex-to-match-vt100-escape-sequences - # Note that re.I doesn't seem to work with this regex (or perhaps the - # version of Python in Ubuntu 14.04), hence the inclusion of a-z inside - # [] instead. - self.re_vt100 = re.compile('(\x1b\[|\x9b)[^@-_a-z]*[@-_a-z]|\x1b[@-_a-z]') + self.re_vt100 = re.compile(r'(\x1b\[|\x9b)[^@-_]*[@-_]|\x1b[@-_]', re.I) (self.pid, self.fd) = pty.fork() if self.pid == 0: @@ -113,7 +110,7 @@ class Spawn(object): Nothing. """ - os.write(self.fd, data) + os.write(self.fd, data.encode(errors='replace')) def expect(self, patterns): """Wait for the sub-process to emit specific data. @@ -171,7 +168,7 @@ class Spawn(object): events = self.poll.poll(poll_maxwait) if not events: raise Timeout() - c = os.read(self.fd, 1024) + c = os.read(self.fd, 1024).decode(errors='replace') if not c: raise EOFError() if self.logfile_read: |