emacs-diffs
[Top][All Lists]
Advanced

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

master bffdb84cda4 1/3: Don't do anything in 'eshell-sentinel' if the pr


From: Jim Porter
Subject: master bffdb84cda4 1/3: Don't do anything in 'eshell-sentinel' if the process status is "run"
Date: Tue, 12 Sep 2023 14:48:54 -0400 (EDT)

branch: master
commit bffdb84cda4f74889407fffed57b09d860a33c63
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    Don't do anything in 'eshell-sentinel' if the process status is "run"
    
    This doesn't change anything right now, but it will prevent future
    issues when we add the ability to resume suspended processes in
    Eshell.
    
    * lisp/eshell/esh-proc.el (eshell-sentinel): Check for "run" status
    earlier.
---
 lisp/eshell/esh-proc.el | 52 ++++++++++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 05ee18401af..50f8c026fab 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -485,44 +485,44 @@ PROC is the process that's exiting.  STRING is the exit 
message."
   (eshell-debug-command
    'process (format-message "sentinel for external process `%s': %S"
                             proc string))
-  (when (buffer-live-p (process-buffer proc))
+  (when (and (buffer-live-p (process-buffer proc))
+             (not (string= string "run")))
     (with-current-buffer (process-buffer proc)
       (unwind-protect
-          (unless (string= string "run")
+          (let* ((handles (process-get proc :eshell-handles))
+                 (index (process-get proc :eshell-handle-index))
+                 (data (process-get proc :eshell-pending))
+                 ;; Only get the status for the primary subprocess,
+                 ;; not the pipe process (if any).
+                 (status (when (= index eshell-output-handle)
+                           (process-exit-status proc))))
             ;; Write the exit message if the status is abnormal and
             ;; the process is already writing to the terminal.
             (when (and (eq proc (eshell-tail-process))
                        (not (string-match "^\\(finished\\|exited\\)"
                                           string)))
               (funcall (process-filter proc) proc string))
-            (let* ((handles (process-get proc :eshell-handles))
-                   (index (process-get proc :eshell-handle-index))
-                   (data (process-get proc :eshell-pending))
-                   ;; Only get the status for the primary subprocess,
-                   ;; not the pipe process (if any).
-                   (status (when (= index eshell-output-handle)
-                            (process-exit-status proc))))
-              (process-put proc :eshell-pending nil)
-              ;; If we're in the middle of handling output from this
-              ;; process then schedule the EOF for later.
-              (letrec ((finish-io
-                        (lambda ()
-                          (if (process-get proc :eshell-busy)
-                              (run-at-time 0 nil finish-io)
-                            (when data
-                              (ignore-error eshell-pipe-broken
-                                (eshell-output-object
-                                 data index handles)))
-                            (eshell-close-handles
-                             status
-                             (when status (list 'quote (= status 0)))
-                             handles)
-                            (eshell-kill-process-function proc string)
+            (process-put proc :eshell-pending nil)
+            ;; If we're in the middle of handling output from this
+            ;; process then schedule the EOF for later.
+            (letrec ((finish-io
+                      (lambda ()
+                        (if (process-get proc :eshell-busy)
+                            (run-at-time 0 nil finish-io)
+                          (when data
+                            (ignore-error eshell-pipe-broken
+                              (eshell-output-object
+                               data index handles)))
+                          (eshell-close-handles
+                           status
+                           (when status (list 'quote (= status 0)))
+                           handles)
+                          (eshell-kill-process-function proc string)
                             (eshell-debug-command
                              'process
                              (format-message
                               "finished external process `%s'" proc))))))
-                (funcall finish-io))))
+              (funcall finish-io)))
         (when-let ((entry (assq proc eshell-process-list)))
           (eshell-remove-process-entry entry))))))
 



reply via email to

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