summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git/cmd.py5
-rw-r--r--git/repo/base.py4
-rw-r--r--git/util.py4
3 files changed, 7 insertions, 6 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 33c15da6..c99c04e2 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -309,9 +309,10 @@ class Git(LazyMixin):
def __getattr__(self, attr):
return getattr(self.proc, attr)
- def wait(self):
+ def wait(self, stderr=None):
"""Wait for the process and return its status code.
+ :param stderr: Previously read value of stderr, in case stderr is already closed.
:warn: may deadlock if output or error pipes are used and not handled separately.
:raise GitCommandError: if the return status is not 0"""
status = self.proc.wait()
@@ -320,7 +321,7 @@ class Git(LazyMixin):
try:
return stream.read()
except ValueError:
- return ''
+ return stderr or ''
if status != 0:
errstr = read_all_from_possibly_closed_stream(self.proc.stderr)
diff --git a/git/repo/base.py b/git/repo/base.py
index 104261dd..9f077fa6 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -827,8 +827,8 @@ class Repo(object):
if progress:
handle_process_output(proc, None, progress.new_message_handler(), finalize_process)
else:
- proc.communicate()
- finalize_process(proc)
+ (stdout, stderr) = proc.communicate()
+ finalize_process(proc, stderr=stderr)
# end handle progress
finally:
if prev_cwd is not None:
diff --git a/git/util.py b/git/util.py
index 00f03f6f..bfcb8941 100644
--- a/git/util.py
+++ b/git/util.py
@@ -150,9 +150,9 @@ def get_user_id():
return "%s@%s" % (getpass.getuser(), platform.node())
-def finalize_process(proc):
+def finalize_process(proc, **kwargs):
"""Wait for the process (clone, fetch, pull or push) and handle its errors accordingly"""
- proc.wait()
+ proc.wait(**kwargs)
#} END utilities