Cache the string-escape codec at bot_update start

It looks the following speculative fix for string-escape codec worked
for depot_tools subprocess2: https://crbug.com/912292#c2.

Using the same approach for bot_update.

R=gavinmak@google.com

Bug: 1255228
Change-Id: I3244d34abad23f9fdbf648e24fc8a565df1474cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3210521
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
changes/21/3210521/2
Josip Sokcevic 4 years ago committed by LUCI CQ
parent 3ed476b8d2
commit 2f6c7fd28a

@ -35,6 +35,12 @@ try:
except ImportError: # pragma: no cover
import urllib.parse as urlparse
# Cache the string-escape codec to ensure subprocess can find it later.
# See crbug.com/912292#c2 for context.
# TODO(crbug.com/1227140): Clean up when py2 is no longer supported.
if sys.version_info.major == 2:
codecs.lookup('string-escape')
# How many bytes at a time to read from pipes.
BUF_SIZE = 256

Loading…
Cancel
Save