From 9dee319c84c52c8e9201e1eb919bc919668366e6 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 9 Jul 2009 18:18:02 -0400 Subject: Py3k: some output is bytes instead of string, so convert since it doesn't matter. --- coverage/backward.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 7ee1e406..8576bbf3 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -46,7 +46,7 @@ else: if sys.hexversion > 0x03000000 and cmd.startswith("coverage "): # We don't have a coverage command on 3.x, so fix it up to call the - # script. + # script. Eventually we won't need this. cmd = "python " + sys.prefix + os.sep + "Scripts" + os.sep + cmd proc = subprocess.Popen(cmd, shell=True, @@ -54,4 +54,11 @@ else: stderr=subprocess.STDOUT ) retcode = proc.wait() - return retcode, proc.stdout.read() + + # Get the output, and canonicalize it to strings with newlines. + output = proc.stdout.read() + if not isinstance(output, str): + output = output.decode('utf-8') + output = output.replace('\r', '') + + return retcode, output -- cgit v1.2.1