aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-12-02 15:44:04 +0000
committerGravatar Mark D. Roth <roth@google.com>2016-12-02 15:44:04 +0000
commit6288542146de017d0e07f733cb70dc9456b647c8 (patch)
tree82b097eb7f268ed34696e5e1a4160a686f67569a
parent405abfcba2735b10403aa946bdb5d37d19b93eb1 (diff)
This time, for sure!
-rwxr-xr-xtools/run_tests/jobset.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py
index 60c8c19758..8c3b6ddda8 100755
--- a/tools/run_tests/jobset.py
+++ b/tools/run_tests/jobset.py
@@ -49,21 +49,18 @@ measure_cpu_costs = False
_DEFAULT_MAX_JOBS = 16 * multiprocessing.cpu_count()
_MAX_RESULT_SIZE = 8192
+
+def strip_non_ascii_chars(s):
+ return ''.join(c for c in s if ord(c) < 128)
+
+
def sanitized_environment(env):
sanitized = {}
for key, value in env.items():
- print("type(key)=", type(key))
- print("key=", key)
- print("type(value)=", type(value))
- print("value=", value)
- print("value hex dump:", ' '.join('%x' % ord(c) for c in value))
- print("type(key.encode(errors='ignore'))=", type(key.encode(errors='ignore')))
- print("key.encode(errors='ignore')=", key.encode(errors='ignore'))
- print("type(value.encode(errors='ignore'))=", type(value.encode(errors='ignore')))
- print("value.encode(errors='ignore')=", value.encode(errors='ignore'))
- sanitized[key.encode(errors='ignore')] = value.encode(errors='ignore')
+ sanitized[strip_non_ascii_chars(key)] = strip_non_ascii_chars(value)
return sanitized
+
def platform_string():
if platform.system() == 'Windows':
return 'windows'