From 57bd9f25449c2368e668087c6df999593ee42580 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 25 Oct 2015 18:27:24 -0400 Subject: Set the PYTHONIOENCODING environment variable in an OS-neutral way. --- tests/helpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/helpers.py') diff --git a/tests/helpers.py b/tests/helpers.py index 2723ea5..f0859f5 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -3,6 +3,7 @@ """Helpers for coverage.py tests.""" +import os import subprocess import sys @@ -17,8 +18,9 @@ def run_command(cmd): # the subprocess is set incorrectly to ascii. Use an environment variable # to force the encoding to be the same as ours. proc = subprocess.Popen( - "PYTHONIOENCODING=%s %s" % (sys.__stdout__.encoding, cmd), + cmd, shell=True, + env=dict(os.environ, PYTHONIOENCODING=sys.__stdout__.encoding), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) -- cgit v1.2.1