subprocess2: cache the string-escape codec at load time.

This is a speculative fix for subprocess being unable to find
string-escape later in execution; the theory being that something
(unclear what) is interfering w/ codecs' lookup logic and that calling
lookup earlier would allow string-escape to be cached before any such
interference. See crbug.com/912292#c2 for more.

Bug: 912292
Change-Id: I0abdd394253c9a4984db7c6c81d044087edc68fd
Reviewed-on: https://chromium-review.googlesource.com/c/1363753
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
changes/53/1363753/4
John Budorick 6 years ago committed by Commit Bot
parent 19238fc343
commit 9875e180e5

@ -8,6 +8,7 @@ In theory you shouldn't need anything else in subprocess, or this module failed.
""" """
import cStringIO import cStringIO
import codecs
import errno import errno
import logging import logging
import os import os
@ -17,6 +18,9 @@ import sys
import time import time
import threading import threading
# Cache the string-escape codec to ensure subprocess can find it later.
# See crbug.com/912292#c2 for context.
codecs.lookup('string-escape')
# Constants forwarded from subprocess. # Constants forwarded from subprocess.
PIPE = subprocess.PIPE PIPE = subprocess.PIPE

Loading…
Cancel
Save