diff options
| author | Noam Postavsky | 2017-02-02 09:19:43 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2017-02-08 23:37:57 -0500 |
| commit | 2bfe83fcd3575d03f371a7d0e6b8c5d661bc5ac7 (patch) | |
| tree | a3597fc9f7e9f53367102a94fafe694244f7a386 /lisp/eshell | |
| parent | 41de25c1134e201235ac7f6e19ecb2925a7df635 (diff) | |
| download | emacs-2bfe83fcd3575d03f371a7d0e6b8c5d661bc5ac7.tar.gz emacs-2bfe83fcd3575d03f371a7d0e6b8c5d661bc5ac7.zip | |
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).
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/esh-proc.el | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index b0dbb229152..ba5cb5c2db7 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." | |||
| 393 | (unless (string= string "run") | 393 | (unless (string= string "run") |
| 394 | (unless (string-match "^\\(finished\\|exited\\)" string) | 394 | (unless (string-match "^\\(finished\\|exited\\)" string) |
| 395 | (eshell-insertion-filter proc string)) | 395 | (eshell-insertion-filter proc string)) |
| 396 | (eshell-close-handles (process-exit-status proc) 'nil | 396 | (let ((handles (nth 1 entry)) |
| 397 | (cadr entry)))) | 397 | (str (prog1 (nth 3 entry) |
| 398 | (setf (nth 3 entry) nil))) | ||
| 399 | (status (process-exit-status proc))) | ||
| 400 | ;; If we're in the middle of handling output | ||
| 401 | ;; from this process then schedule the EOF for | ||
| 402 | ;; later. | ||
| 403 | (letrec ((finish-io | ||
| 404 | (lambda () | ||
| 405 | (if (nth 4 entry) | ||
| 406 | (run-at-time 0 nil finish-io) | ||
| 407 | (when str (eshell-output-object str nil handles)) | ||
| 408 | (eshell-close-handles status 'nil handles))))) | ||
| 409 | (funcall finish-io))))) | ||
| 398 | (eshell-remove-process-entry entry)))) | 410 | (eshell-remove-process-entry entry)))) |
| 399 | (eshell-kill-process-function proc string))))) | 411 | (eshell-kill-process-function proc string))))) |
| 400 | 412 | ||