Skip to content

Commit 140b64d

Browse files
committed
Better fix for chubin#307 is to return text stream from Popen
`universal_newlines` make this in compatible way with older Python.
1 parent ac3ed3c commit 140b64d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/fetch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ def _fetch_locations(known_location):
5757
sys.stdout.write("Fetching %s..." % (adptr))
5858
sys.stdout.flush()
5959
try:
60-
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
60+
process = subprocess.Popen(
61+
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
62+
universal_newlines=True)
6163
except OSError:
6264
print("\nERROR: %s" % cmd)
6365
raise
6466
output = process.communicate()[0]
6567
if process.returncode != 0:
66-
sys.stdout.write("\nERROR:\n---\n" + str(output))
68+
sys.stdout.write("\nERROR:\n---\n" + output)
6769
fatal("---\nCould not fetch %s" % adptr)
6870
else:
6971
print("Done")

0 commit comments

Comments
 (0)