From 50b74d4fa93d96f455e27d3902f857c7f4d8f7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarek=20Ziad=C3=A9?= Date: Tue, 5 Nov 2019 07:11:50 +0000 Subject: [PATCH] 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 --- testing/condprofile/condprof/android.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/testing/condprofile/condprof/android.py b/testing/condprofile/condprof/android.py index b9167f8a5193..c462e6febd22 100644 --- a/testing/condprofile/condprof/android.py +++ b/testing/condprofile/condprof/android.py @@ -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")