diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-11-27 15:11:52 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-11-27 15:11:52 +0100 |
commit | 073bb2c022a2eb9031f6ef84970c3fa153e764a7 (patch) | |
tree | 78d7e96ae89f0849b1f3c8c59fa93c55b33e05e8 | |
parent | 912fd592c8b97a309ebf9fb261abe52ea1a10c2d (diff) | |
download | gemato-073bb2c022a2eb9031f6ef84970c3fa153e764a7.tar.gz |
openpgp: Make missing gpgconf non-fatal
-rw-r--r-- | gemato/openpgp.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gemato/openpgp.py b/gemato/openpgp.py index 6df28de..56257f5 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -71,9 +71,15 @@ class OpenPGPEnvironment(object): def close(self): if self._home is not None: if self._started: - # terminate the agent spawned by the process - subprocess.Popen(['gpgconf', '--kill', 'all'], - env={'GNUPGHOME': self._home}).wait() + try: + # terminate the agent spawned by the process + subprocess.Popen(['gpgconf', '--kill', 'all'], + env={'GNUPGHOME': self._home}).wait() + except OSError as e: + # ignore ENOENT -- most likely it means gpg1 which + # had no gpg-agent + if e.errno != errno.ENOENT: + raise shutil.rmtree(self._home, onerror=self._rmtree_error_handler) self._home = None |