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>
diff --git a/cbuildbot/commands.py b/cbuildbot/commands.py
index 5e85b7d..d590f08 100644
--- a/cbuildbot/commands.py
+++ b/cbuildbot/commands.py
@@ -149,7 +149,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.run