From 3709e06b5c48fd56f43702d51edd80dfbe070678 Mon Sep 17 00:00:00 2001 From: Javi Merino Date: Thu, 16 Apr 2020 15:19:20 +0100 Subject: [PATCH] utils/android: LogcatMonitor: put pexpect.spawn() in str mode By default, pexpect.spawn() is a bytes interface: its read methods return bytes and its write/send and expect method expect bytes. Logcat uses utf-8 strings, so put pexpect.spawn() in str mode. This code can't have worked in python3 before, since the logcat file is not opened in "b" mode. --- devlib/utils/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/utils/android.py b/devlib/utils/android.py index 0bdfed3..e6f5f11 100755 --- a/devlib/utils/android.py +++ b/devlib/utils/android.py @@ -753,7 +753,7 @@ class LogcatMonitor(object): logcat_cmd = get_adb_command(self.target.conn.device, logcat_cmd) logger.debug('logcat command ="{}"'.format(logcat_cmd)) - self._logcat = pexpect.spawn(logcat_cmd, logfile=self._logfile) + self._logcat = pexpect.spawn(logcat_cmd, logfile=self._logfile, encoding='utf-8') def stop(self): self._logcat.terminate()