Skip to content

Commit 2cc8f1e

Browse files
rikdevРябченко Иван Константинович
authored and
Рябченко Иван Константинович
committed
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)
1 parent 51f79ff commit 2cc8f1e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎git/cmd.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ def wait(self):
310310
"""Wait for the process and return its status code.
311311
312312
:raise GitCommandError: if the return status is not 0"""
313-
status = self.proc.wait()
314-
if status != 0:
315-
raise GitCommandError(self.args, status, self.proc.stderr.read())
313+
stderr_value = self.proc.communicate()[1]
314+
if self.proc.returncode != 0:
315+
raise GitCommandError(self.args, status, stderr_value)
316316
# END status handling
317-
return status
317+
return self.proc.returncode
318318
# END auto interrupt
319319

320320
class CatFileContentStream(object):

0 commit comments

Comments
 (0)