Bug 1593603 - Fix encoding issue on android r=rwood

Fix encoding issue on android

Differential Revision: https://phabricator.services.mozilla.com/D51569

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tarek Ziadé 2019-11-05 07:11:50 +00:00
Родитель 0c0da7791e
Коммит 50b74d4fa9
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -209,14 +209,19 @@ class AndroidEnv(BaseEnv):
return "%s-%s" % (self.device_name, app)
def dump_logs(self):
logcat = self.device.get_logcat()
try:
logcat = self.device.get_logcat()
except ADBError:
ERROR("logcat call failure")
return
if logcat:
# local path, not using posixpath
logfile = os.path.join(self.archive, "logcat.log")
LOG("Writing logcat at %s" % logfile)
with open(logfile, "w") as f:
with open(logfile, "wb") as f:
for line in logcat:
f.write(line + "\n")
f.write(line.encode("utf8") + b"\n")
else:
LOG("logcat came back empty")