diff options
author | mathieui <mathieui@mathieui.net> | 2014-07-09 16:00:22 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-07-09 16:00:22 +0200 |
commit | dc5e3b33f7cdc59b5eefcf8d1a1dccc4ac5e1bee (patch) | |
tree | b59ecf3bbfd4092910c6fdf7bf293627df93d5be /plugins/gpg | |
parent | e0e2123a4be207a65e48e016007e71579fae2ba5 (diff) | |
download | poezio-dc5e3b33f7cdc59b5eefcf8d1a1dccc4ac5e1bee.tar.gz poezio-dc5e3b33f7cdc59b5eefcf8d1a1dccc4ac5e1bee.tar.bz2 poezio-dc5e3b33f7cdc59b5eefcf8d1a1dccc4ac5e1bee.tar.xz poezio-dc5e3b33f7cdc59b5eefcf8d1a1dccc4ac5e1bee.zip |
Fix #2546 (ugly tb with the gpg plugin)
Diffstat (limited to 'plugins/gpg')
-rw-r--r-- | plugins/gpg/gnupg.py | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/plugins/gpg/gnupg.py b/plugins/gpg/gnupg.py index 9109451a..5cb11766 100644 --- a/plugins/gpg/gnupg.py +++ b/plugins/gpg/gnupg.py @@ -561,27 +561,31 @@ class GPG(object): # # Calls methods on the response object for each valid token found, # with the arg being the remainder of the status line. - lines = [] - while True: - line = stream.readline() - if len(line) == 0: - break - lines.append(line) - line = line.rstrip() - if self.verbose: - print(line) - logger.debug("%s", line) - if line[0:9] == '[GNUPG:] ': - # Chop off the prefix - line = line[9:] - L = line.split(None, 1) - keyword = L[0] - if len(L) > 1: - value = L[1] - else: - value = "" - result.handle_status(keyword, value) - result.stderr = ''.join(lines) + try: + lines = [] + while True: + line = stream.readline() + if len(line) == 0: + break + lines.append(line) + line = line.rstrip() + if self.verbose: + print(line) + logger.debug("%s", line) + if line[0:9] == '[GNUPG:] ': + # Chop off the prefix + line = line[9:] + L = line.split(None, 1) + keyword = L[0] + if len(L) > 1: + value = L[1] + else: + value = "" + result.handle_status(keyword, value) + result.stderr = ''.join(lines) + except: + import traceback + logger.error('Error in the GPG plugin:\n%s', traceback.format_exc()) def _read_data(self, stream, result): # Read the contents of the file from GPG's stdout |