From df47175a74674c42171deb0aef8175081e0e8f5b Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sun, 26 Nov 2017 23:37:42 +0100 Subject: 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/ directory present and places sockets there. This makes sure they are always determinated immediately. --- gemato/openpgp.py | 3 +++ 1 file changed, 3 insertions(+) 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 -- cgit v1.2.3