From fc417dae2210d49aef53fd8ceb7d73073c9ddeb3 Mon Sep 17 00:00:00 2001 From: Mike Dougherty Date: Tue, 23 Dec 2014 18:03:15 -0800 Subject: [PATCH 1/2] Use communicate so as not to lock up the subprocess --- git/remote.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git/remote.py b/git/remote.py index bce11f7d6..15b5305ae 100644 --- a/git/remote.py +++ b/git/remote.py @@ -33,6 +33,7 @@ import re import os import sys +import io __all__ = ('RemoteProgress', 'PushInfo', 'FetchInfo', 'Remote') @@ -547,10 +548,11 @@ def _get_push_info(self, proc, progress): # we hope stdout can hold all the data, it should ... # read the lines manually as it will use carriage returns between the messages # to override the previous one. This is why we read the bytes manually - digest_process_messages(proc.stderr, progress) + stdout, stderr = proc.communicate() + digest_process_messages(io.StringIO(stderr), progress) output = IterableList('name') - for line in proc.stdout.readlines(): + for line in stdout.splitlines(): try: output.append(PushInfo._from_line(self, line)) except ValueError: @@ -559,7 +561,6 @@ def _get_push_info(self, proc, progress): # END exception handling # END for each line - finalize_process(proc) return output def fetch(self, refspec=None, progress=None, **kwargs): From 2752f7068fb6fc160f63eabec3964263171593e3 Mon Sep 17 00:00:00 2001 From: Mike Dougherty Date: Tue, 23 Dec 2014 18:16:39 -0800 Subject: [PATCH 2/2] Use BytesIO, not StringIO --- git/remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/remote.py b/git/remote.py index 15b5305ae..b0d155350 100644 --- a/git/remote.py +++ b/git/remote.py @@ -549,7 +549,7 @@ def _get_push_info(self, proc, progress): # read the lines manually as it will use carriage returns between the messages # to override the previous one. This is why we read the bytes manually stdout, stderr = proc.communicate() - digest_process_messages(io.StringIO(stderr), progress) + digest_process_messages(io.BytesIO(stderr), progress) output = IterableList('name') for line in stdout.splitlines():