Skip to content

Commit

Permalink
pumps: FIX don't pump when proc has no streams
Browse files Browse the repository at this point in the history
  • Loading branch information
ankostis committed Oct 12, 2016
1 parent c3c170c commit e316575
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ def pump_stream(cmdline, name, stream, is_decode, handler):
cmdline = getattr(process, 'args', '') # PY3+ only
if not isinstance(cmdline, (tuple, list)):
cmdline = cmdline.split()

pumps = []
if process.stdout:
pumps.append(('stdout', process.stdout, stdout_handler))
if process.stderr:
pumps.append(('stderr', process.stderr, stderr_handler))

threads = []
for name, stream, handler in (
('stdout', process.stdout, stdout_handler),
('stderr', process.stderr, stderr_handler),
):

for name, stream, handler in pumps:
t = threading.Thread(target=pump_stream,
args=(cmdline, name, stream, decode_streams, handler))
t.setDaemon(True)
Expand Down

0 comments on commit e316575

Please sign in to comment.