From 94fe9f56748ac8a73b313df80c666dd020a5d46c Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Fri, 9 Dec 2022 23:07:19 -0800 Subject: [PATCH] Fix a race condition in Eshell's external process management If a process is busy writing output when 'eshell-sentinel' is called, it might take a bit of time to finish up. Don't call 'eshell-kill-process-function' until we're really finished (bug#59103). * lisp/eshell/esh-proc.el (eshell-sentinel): Call 'eshell-kill-process-function' in 'finish-io'. --- lisp/eshell/esh-proc.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 950922ea7f8..199ed3cc622 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el @@ -473,11 +473,11 @@ eshell-sentinel (eshell-close-handles status (when status (list 'quote (= status 0))) - handles))))) + handles) + (eshell-kill-process-function proc string))))) (funcall finish-io)))) (when-let ((entry (assq proc eshell-process-list))) - (eshell-remove-process-entry entry)) - (eshell-kill-process-function proc string))))) + (eshell-remove-process-entry entry)))))) (defun eshell-process-interact (func &optional all query) "Interact with a process, using PROMPT if more than one, via FUNC. -- 2.25.1