Skip to content

Commit 4909e3a

Browse files
committed
driver/fastbootdriver: decode output to str before split
processwrapper.check_output returns a byte-like object, which is not compatible with split() with an str. Decode the output to a str to fix this. This fixes direct calls of the getvar function from a test suite. Calling `fastboot getvar` from the command line doesn't use the filtering mechanism and is successful without this fix. The alternatives would have been to change the callers of _filter_fastboot_output to convert the byte-like object to a string, or to change '\n' to a byte-like object. The latter would also need a change of the startswith call. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
1 parent 05a4eda commit 4909e3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

labgrid/driver/fastbootdriver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _filter_fastboot_output(output, prefix='(bootloader) '):
5959
Splits output by '\n' and returns only elements starting with prefix. The prefix is
6060
removed.
6161
"""
62-
return [line[len(prefix):] for line in output.split('\n') if line.startswith(prefix)]
62+
return [line[len(prefix):] for line in output.decode().split('\n') if line.startswith(prefix)]
6363

6464
def on_activate(self):
6565
pass

0 commit comments

Comments
 (0)