cros_chrome_sdk/deploy_chrome: use encoding=utf-8 with commands
When we run gsutil or remote commands and parse their text, make
sure we encode their output into UTF-8 strings.
BUG=chromium:997354
TEST=`./run_tests` passes
Change-Id: I6fee7784283d6e32df5d1a2eca5cc463ddbc39a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1940787
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
diff --git a/scripts/deploy_chrome.py b/scripts/deploy_chrome.py
index 9498a8e..4336f93 100644
--- a/scripts/deploy_chrome.py
+++ b/scripts/deploy_chrome.py
@@ -120,12 +120,13 @@
def _GetRemoteDirSize(self, remote_dir):
result = self.device.RunCommand('du -ks %s' % remote_dir,
- capture_output=True)
+ capture_output=True, encoding='utf-8')
return int(result.output.split()[0])
def _GetStagingDirSize(self):
result = cros_build_lib.dbg_run(['du', '-ks', self.staging_dir],
- redirect_stdout=True, capture_output=True)
+ redirect_stdout=True, capture_output=True,
+ encoding='utf-8')
return int(result.output.split()[0])
def _ChromeFileInUse(self):
@@ -173,7 +174,8 @@
# <job_name> <status> ['process' <pid>].
# <status> is in the format <goal>/<state>.
try:
- result = self.device.RunCommand('status ui', capture_output=True)
+ result = self.device.RunCommand('status ui', capture_output=True,
+ encoding='utf-8')
except cros_build_lib.RunCommandError as e:
if 'Unknown job' in e.result.error:
return False
@@ -218,7 +220,7 @@
# TODO: Should migrate to use the remount functions in remote_access.
result = self.device.RunCommand(MOUNT_RW_COMMAND,
error_code_ok=error_code_ok,
- capture_output=True)
+ capture_output=True, encoding='utf-8')
if result.returncode and not self.device.IsDirWritable('/'):
self._root_dir_is_still_readonly.set()