Skip to content

fix(cmd): fixed deadlock when stderr buffer overflow #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
  • Loading branch information
rikdev authored and Рябченко Иван Константинович committed Oct 15, 2015
commit 2cc8f1e3c6627f0b4da7cb6550f7252f76529d8e
8 changes: 4 additions & 4 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ def wait(self):
"""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):
Expand Down