don't fails gpg encryption when verbose is on. check in status-fd if encryption succeeded. fixes #3542
This commit is contained in:
parent
24413948ab
commit
bdb7502dc3
1 changed files with 20 additions and 3 deletions
|
@ -92,19 +92,36 @@ else:
|
||||||
return str, 'GnuPG not usable'
|
return str, 'GnuPG not usable'
|
||||||
self.options.recipients = recipients # a list!
|
self.options.recipients = recipients # a list!
|
||||||
|
|
||||||
proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout',
|
proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout', 'status',
|
||||||
'stderr'])
|
'stderr'])
|
||||||
proc.handles['stdin'].write(str)
|
proc.handles['stdin'].write(str)
|
||||||
proc.handles['stdin'].close()
|
try:
|
||||||
|
proc.handles['stdin'].close()
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
|
||||||
output = proc.handles['stdout'].read()
|
output = proc.handles['stdout'].read()
|
||||||
proc.handles['stdout'].close()
|
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()
|
error = proc.handles['stderr'].read()
|
||||||
proc.handles['stderr'].close()
|
proc.handles['stderr'].close()
|
||||||
|
|
||||||
try: proc.wait()
|
try: proc.wait()
|
||||||
except IOError: pass
|
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
|
return self._stripHeaderFooter(output), error
|
||||||
|
|
||||||
def decrypt(self, str, keyID):
|
def decrypt(self, str, keyID):
|
||||||
|
|
Loading…
Add table
Reference in a new issue