summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-11-26 23:37:42 +0100
committerMichał Górny <mgorny@gentoo.org>2017-11-26 23:37:42 +0100
commitdf47175a74674c42171deb0aef8175081e0e8f5b (patch)
tree1a0a997e1cc44c9686a7b5a031b9617157020899
parent5f32b1e43c3a3bbaa7f09441268d4f2217b0ca23 (diff)
downloadgemato-df47175a74674c42171deb0aef8175081e0e8f5b.tar.gz
openpgp: Make sure to kill the GPG daemons in isolated env
Kill the GPG daemon processes as soon as the environment is being removed. This will normally happen when the socket is removed, which is not the case when GnuPG detects /run/user/<uid> directory present and places sockets there. This makes sure they are always determinated immediately.
-rw-r--r--gemato/openpgp.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/gemato/openpgp.py b/gemato/openpgp.py
index 951ab79..9078b59 100644
--- a/gemato/openpgp.py
+++ b/gemato/openpgp.py
@@ -55,6 +55,9 @@ class OpenPGPEnvironment(object):
def close(self):
if self._home is not None:
+ # terminate the agent spawned by the process
+ subprocess.Popen(['gpgconf', '--kill', 'all'],
+ env={'GNUPGHOME': self._home}).wait()
shutil.rmtree(self._home)
self._home = None