emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c2dea98: Kill gpg-agents started by mml-sec-tests (bug#43358)


From: Lars Ingebrigtsen
Subject: master c2dea98: Kill gpg-agents started by mml-sec-tests (bug#43358)
Date: Sun, 13 Sep 2020 10:05:33 -0400 (EDT)

branch: master
commit c2dea983e8016dab6e76a10d8b02ffbf894e2760
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Kill gpg-agents started by mml-sec-tests (bug#43358)
---
 test/lisp/gnus/mml-sec-tests.el | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el
index b715383..ba0783b 100644
--- a/test/lisp/gnus/mml-sec-tests.el
+++ b/test/lisp/gnus/mml-sec-tests.el
@@ -82,7 +82,9 @@ instead of gpg-agent."
              ;; not look in the proper places otherwise, see:
              ;; https://bugs.gnupg.org/gnupg/issue2126
              (setenv "GNUPGHOME" epg-gpg-home-directory)
-             (funcall body))
+              (unwind-protect
+                 (funcall body)
+                (mml-sec-test--kill-gpg-agent)))
          (error
           (setenv "GPG_AGENT_INFO" agent-info)
           (setenv "GNUPGHOME" gpghome)
@@ -903,4 +905,16 @@ So the second decryption fails."
   (let ((with-smime nil))
     (ert-run-tests-batch)))
 
+(defun mml-sec-test--kill-gpg-agent ()
+  (dolist (pid (list-system-processes))
+    (let ((atts (process-attributes pid)))
+      (when (and (equal (cdr (assq 'user atts)) (user-login-name))
+                 (equal (cdr (assq 'comm atts)) "gpg-agent")
+                 (string-match
+                  (concat "homedir.*"
+                          (regexp-quote (expand-file-name "test/data/mml-sec"
+                                                          source-directory)))
+                  (cdr (assq 'args atts))))
+        (call-process "kill" nil nil nil (format "%d" pid))))))
+
 ;;; mml-sec-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]