Add clearer logging to gnupg.GPGBase._read_data().

fix/24-enc-to-file
Isis Lovecruft 2013-10-08 11:44:45 +00:00
parent 78400df41c
commit 4780f4443d
No known key found for this signature in database
GPG Key ID: 5C17776E27F7E84D
1 changed files with 5 additions and 1 deletions

View File

@ -533,15 +533,19 @@ class GPGBase(object):
:attr:`GPGBase._result_mapping`.
"""
chunks = []
log.debug("Reading data from stream %r..." % stream.__repr__())
while True:
data = stream.read(1024)
if len(data) == 0:
break
log.debug("read from stdout: %r" % data[:256])
chunks.append(data)
log.debug("Read %4d bytes" % len(data))
# Join using b'' or '', as appropriate
result.data = type(data)().join(chunks)
log.debug("Finishing reading from stream %r..." % stream.__repr__())
log.debug("Read %4d bytes total" % len(result.data))
def _collect_output(self, process, result, writer=None, stdin=None):
"""Drain the subprocesses output streams, writing the collected output