emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 2bfe83f: Make sure eshell pipelines don't drop data


From: Noam Postavsky
Subject: [Emacs-diffs] master 2bfe83f: Make sure eshell pipelines don't drop data
Date: Wed, 8 Feb 2017 23:44:41 -0500 (EST)

branch: master
commit 2bfe83fcd3575d03f371a7d0e6b8c5d661bc5ac7
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Make sure eshell pipelines don't drop data
    
    * lisp/eshell/esh-proc.el (eshell-sentinel): If called while still
    handling output of the process, make sure to close the pipes only later,
    so that the next process in the pipeline recieves EOF only after getting
    all its input (Bug#25549).
---
 lisp/eshell/esh-proc.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index b0dbb22..ba5cb5c 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -393,8 +393,20 @@ PROC is the process that's exiting.  STRING is the exit 
message."
                    (unless (string= string "run")
                      (unless (string-match "^\\(finished\\|exited\\)" string)
                        (eshell-insertion-filter proc string))
-                     (eshell-close-handles (process-exit-status proc) 'nil
-                                           (cadr entry))))
+                      (let ((handles (nth 1 entry))
+                            (str (prog1 (nth 3 entry)
+                                   (setf (nth 3 entry) nil)))
+                            (status (process-exit-status proc)))
+                        ;; If we're in the middle of handling output
+                        ;; from this process then schedule the EOF for
+                        ;; later.
+                        (letrec ((finish-io
+                                  (lambda ()
+                                    (if (nth 4 entry)
+                                        (run-at-time 0 nil finish-io)
+                                      (when str (eshell-output-object str nil 
handles))
+                                      (eshell-close-handles status 'nil 
handles)))))
+                          (funcall finish-io)))))
                (eshell-remove-process-entry entry))))
        (eshell-kill-process-function proc string)))))
 



reply via email to

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