Skip to content

Commit

Permalink
Read gpg output a line at a time, looking for status-fd output
Browse files Browse the repository at this point in the history
  • Loading branch information
micahflee committed Jul 8, 2016
1 parent 3dc82e1 commit 0bb3764
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions torbrowser_launcher/common.py
Expand Up @@ -212,14 +212,14 @@ def import_key_and_check_status(self, key):
stderr=subprocess.PIPE)
p.wait()

output = p.stderr.read()
print "---output begin---\n{}\n---output end---".format(output)
match = gnupg_import_ok_pattern.match(output)
if match:
# The output must match everything in the
# ``gnupg_import_ok_pattern``, as well as the expected fingerprint:
if match.group().find(self.fingerprints[key]) >= 0:
success = True
for output in p.stderr.readlines():
match = gnupg_import_ok_pattern.match(output)
if match:
# The output must match everything in the
# ``gnupg_import_ok_pattern``, as well as the expected fingerprint:
if match.group().find(self.fingerprints[key]) >= 0:
success = True
break

return success

Expand All @@ -231,12 +231,6 @@ def import_keys(self):
:returns: ``True`` if all keys were successfully imported; ``False``
otherwise.
"""

# run "gpg --list-keys" first, to create an empty keyring before importing
#subprocess.call(['/usr/bin/gpg',
# '--homedir', self.paths['gnupg_homedir'],
# '--list-secret-keys'])

keys = ['tor_browser_developers',]
all_imports_succeeded = True

Expand Down

0 comments on commit 0bb3764

Please sign in to comment.