cbuildbot/commands.py: Fix for python3/encoding issue.
BUG=chromium:1161648
TEST=CQ
Change-Id: Ibba5f2e04d4b03e0ef5d5b8528279f61d864d906
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2628348
Commit-Queue: Alex Klein <saklein@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
(cherry picked from commit 748a28637a223f8dae0926c33ebbc991695bd473)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2630650
diff --git a/cbuildbot/commands.py b/cbuildbot/commands.py
index 680a45d..0b8f60a 100644
--- a/cbuildbot/commands.py
+++ b/cbuildbot/commands.py
@@ -130,7 +130,8 @@
with cros_build_lib.ContextManagerStack() as stack:
if enter_chroot and os.path.exists(chroot_tmp):
kwargs['extra_env'] = (kwargs.get('extra_env') or {}).copy()
- status_file = stack.Add(tempfile.NamedTemporaryFile, dir=chroot_tmp)
+ status_file = stack.Add(tempfile.NamedTemporaryFile, dir=chroot_tmp,
+ mode='w+', encoding='utf-8')
kwargs['extra_env'][constants.PARALLEL_EMERGE_STATUS_FILE_ENVVAR] = \
path_util.ToChrootPath(status_file.name)
runcmd = cros_build_lib.RunCommand