fix: [PgpDump] catch UnicodeDecodeError error

This commit is contained in:
Terrtia 2019-06-12 10:33:40 +02:00
parent e71daac7d2
commit 2b6cb86d55
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -82,7 +82,12 @@ def get_pgp_packet(message, save_path):
process1 = subprocess.Popen([ 'echo', '-e', save_path], stdout=subprocess.PIPE) process1 = subprocess.Popen([ 'echo', '-e', save_path], stdout=subprocess.PIPE)
process2 = subprocess.Popen([ 'pgpdump'], stdin=process1.stdout, stdout=subprocess.PIPE) process2 = subprocess.Popen([ 'pgpdump'], stdin=process1.stdout, stdout=subprocess.PIPE)
process1.stdout.close() process1.stdout.close()
output = process2.communicate()[0].decode() output = process2.communicate()[0]
try:
output = output.decode()
except UnicodeDecodeError:
publisher.error('Error PgpDump UnicodeDecodeError: {}'.format(message))
output = ''
return output return output
def get_pgp_packet_file(file): def get_pgp_packet_file(file):