don't fails gpg encryption when verbose is on. check in status-fd if encryption succeeded. fixes #3542

This commit is contained in:
Yann Leboulanger 2007-11-13 22:40:49 +00:00
parent 24413948ab
commit bdb7502dc3
1 changed files with 20 additions and 3 deletions

View File

@ -92,19 +92,36 @@ else:
return str, 'GnuPG not usable'
self.options.recipients = recipients # a list!
proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout',
proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout', 'status',
'stderr'])
proc.handles['stdin'].write(str)
try:
proc.handles['stdin'].close()
except IOError:
pass
output = proc.handles['stdout'].read()
try:
proc.handles['stdout'].close()
except IOError:
pass
stat = proc.handles['status']
resp = self._read_response(stat)
try:
proc.handles['status'].close()
except IOError:
pass
error = proc.handles['stderr'].read()
proc.handles['stderr'].close()
try: proc.wait()
except IOError: pass
if 'BEGIN_ENCRYPTION' in resp and 'END_ENCRYPTION' in resp:
# Encryption succeeded, even if there is output on stderr. Maybe
# verbose is on
error = ''
return self._stripHeaderFooter(output), error
def decrypt(self, str, keyID):