From: Mattias EngdegÄrd Date: Sat, 20 Apr 2024 11:08:20 +0000 (+0200) Subject: Kill process in files-tests before exiting X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d442c63e97c8e0063b1f132b659979491e934a5f;p=emacs.git Kill process in files-tests before exiting * test/lisp/files-tests.el (files-tests-file-name-non-special-start-file-process): Make sure that the subprocess is killed before the test concludes. (cherry picked from commit a4a136217dd20ee701d28ac1adfc828bfdd4655e) --- diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index d4c1ef3ba67..ad54addf06b 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1196,18 +1196,21 @@ unquoted file names." "emacs" (current-buffer) (concat invocation-directory invocation-name) "--version"))) - (accept-process-output proc) - (goto-char (point-min)) - (should (search-forward emacs-version nil t)) - ;; Don't stop the test run with a query, as the subprocess - ;; may or may not be dead by the time we reach here. - (set-process-query-on-exit-flag proc nil) - ;; On MS-Windows, wait for the process to die, since the OS - ;; will not let us delete a directory that is the cwd of a - ;; running process. - (when (eq system-type 'windows-nt) - (while (process-live-p proc) - (sleep-for 0.1))))))) + (unwind-protect + (progn + (accept-process-output proc) + (goto-char (point-min)) + (should (search-forward emacs-version nil t)) + ;; Don't stop the test run with a query, as the subprocess + ;; may or may not be dead by the time we reach here. + (set-process-query-on-exit-flag proc nil) + ;; On MS-Windows, wait for the process to die, since the OS + ;; will not let us delete a directory that is the cwd of a + ;; running process. + (when (eq system-type 'windows-nt) + (while (process-live-p proc) + (sleep-for 0.1)))) + (delete-process proc)))))) (files-tests--with-temp-non-special-and-file-name-handler (tmpdir nospecial-dir t) (with-temp-buffer