]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix a race condition in Eshell's external process management
authorJim Porter <jporterbugs@gmail.com>
Sat, 10 Dec 2022 07:07:19 +0000 (23:07 -0800)
committerJim Porter <jporterbugs@gmail.com>
Sun, 27 Aug 2023 19:26:19 +0000 (12:26 -0700)
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

index f2d20b4cdedd6a98a7d7e4e32ed919a66913fabe..9c4036004ff505707e115089d89e22c2c0ef4e50 100644 (file)
@@ -491,11 +491,11 @@ PROC is the process that's exiting.  STRING is the exit message."
                             (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.