mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-20 04:30:55 -08:00
When closing an Eshell process target, send EOF three times
* lisp/eshell/esh-io.el (eshell-close-target): Send EOF 3 times. * test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest): Re-enable these tests on EMBA. This patch is adapted by one from Ken Brown, who uncovered the reason for this bug (bug#56025).
This commit is contained in:
parent
51f24fe2f4
commit
7faea4a15e
2 changed files with 14 additions and 3 deletions
|
|
@ -276,8 +276,20 @@ STATUS should be non-nil on successful termination of the output."
|
||||||
;; If we're redirecting to a process (via a pipe, or process
|
;; If we're redirecting to a process (via a pipe, or process
|
||||||
;; redirection), send it EOF so that it knows we're finished.
|
;; redirection), send it EOF so that it knows we're finished.
|
||||||
((eshell-processp target)
|
((eshell-processp target)
|
||||||
(if (eq (process-status target) 'run)
|
;; According to POSIX.1-2017, section 11.1.9, sending EOF causes
|
||||||
(process-send-eof target)))
|
;; all bytes waiting to be read to be sent to the process
|
||||||
|
;; immediately. Thus, if there are any bytes waiting, we need to
|
||||||
|
;; send EOF twice: once to flush the buffer, and a second time to
|
||||||
|
;; cause the next read() to return a size of 0, indicating
|
||||||
|
;; end-of-file to the reading process. However, some platforms
|
||||||
|
;; (e.g. Solaris) actually require sending a *third* EOF. Since
|
||||||
|
;; sending extra EOFs while the process is running shouldn't break
|
||||||
|
;; anything, we'll just send the maximum we'd ever need. See
|
||||||
|
;; bug#56025 for further details.
|
||||||
|
(let ((i 0))
|
||||||
|
(while (and (<= (cl-incf i) 3)
|
||||||
|
(eq (process-status target) 'run))
|
||||||
|
(process-send-eof target))))
|
||||||
|
|
||||||
;; A plain function redirection needs no additional arguments
|
;; A plain function redirection needs no additional arguments
|
||||||
;; passed.
|
;; passed.
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,6 @@
|
||||||
(skip-unless shell-file-name)
|
(skip-unless shell-file-name)
|
||||||
(skip-unless shell-command-switch)
|
(skip-unless shell-command-switch)
|
||||||
(skip-unless (executable-find shell-file-name))
|
(skip-unless (executable-find shell-file-name))
|
||||||
(skip-unless (not (getenv "EMACS_EMBA_CI")))
|
|
||||||
(let ((input ,input))
|
(let ((input ,input))
|
||||||
(with-temp-eshell ,@body)))))
|
(with-temp-eshell ,@body)))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue