summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Ryabchenko <rik.ggm@gmail.com>2015-10-15 12:23:21 +0600
committerРябченко Иван Константинович <i.ryabchenko@2gis.ru>2015-10-15 12:31:25 +0600
commit2cc8f1e3c6627f0b4da7cb6550f7252f76529d8e (patch)
tree25db781ea4a89b55526bb4abc91face04fdd01dc
parent51f79ffeb829315c33ce273ae69baf0fdd1fbd1e (diff)
downloadgitpython-2cc8f1e3c6627f0b4da7cb6550f7252f76529d8e.tar.gz
fix(cmd): fixed deadlock when stderr buffer overflow
Fixed deadlock when using stderr=PIPE in Popen and Git generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data (see https://docs.python.org/2/library/subprocess.html#subprocess.Popen.wait)
-rw-r--r--git/cmd.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 3cdc68ab..6cf4d8a6 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -310,11 +310,11 @@ class Git(LazyMixin):
"""Wait for the process and return its status code.
:raise GitCommandError: if the return status is not 0"""
- status = self.proc.wait()
- if status != 0:
- raise GitCommandError(self.args, status, self.proc.stderr.read())
+ stderr_value = self.proc.communicate()[1]
+ if self.proc.returncode != 0:
+ raise GitCommandError(self.args, status, stderr_value)
# END status handling
- return status
+ return self.proc.returncode
# END auto interrupt
class CatFileContentStream(object):