diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-01-30 18:53:53 -0800 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-02-03 20:02:22 +0100 |
commit | 3a388ab4a604f868ab2c1f9b3c63a7f7a3221f7f (patch) | |
tree | e0c4cb817c5dc16179305307ec0b56e527d7f36d /lisp/eshell/esh-proc.el | |
parent | 2e60ef696a3cf16b0eb297948e27ba0cb32a125e (diff) | |
download | emacs-3a388ab4a604f868ab2c1f9b3c63a7f7a3221f7f.tar.gz emacs-3a388ab4a604f868ab2c1f9b3c63a7f7a3221f7f.tar.bz2 emacs-3a388ab4a604f868ab2c1f9b3c63a7f7a3221f7f.zip |
When executing an Eshell pipeline, send input to the first process
Previously, input was sent to the last process in the pipeline,
resulting in unexpected behavior when running commands like
'tr a-z A-Z | rev'.
* lisp/eshell/esh-util.el (eshell-process-pair-p)
(eshell-make-process-pair): New functions.
* lisp/eshell/esh-cmd.el (eshell-last-async-proc): Rename to...
(eshell-last-async-procs): ... this, and store a pair of processes.
(eshell-interactive-process): Replace with...
(eshell-interactive-process-p, eshell-head-process)
(eshell-tail-process): ... these.
(eshell-cmd-initialize): Set 'eshell-last-async-procs'.
(eshell-do-pipelines): Set 'headproc'.
(eshell-execute-pipeline): Return 'headproc' and 'tailproc'.
(eshell-resume-eval): Use 'eshell-last-async-procs'.
(eshell-do-eval): Make sure we work with a pair of processes.
* lisp/eshell/esh-proc.el (eshell-send-eof-to-process): Move from
here...
* lisp/eshell/esh-mode.el (eshell-send-eof-to-process): ... to here,
and only send EOF to the head process.
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments)
* lisp/eshell/esh-mode.el (eshell-intercept-commands)
(eshell-watch-for-password-prompt):
Use 'eshell-interactive-process-p'.
* lisp/eshell/em-rebind.el (eshell-delchar-or-maybe-eof)
* lisp/eshell/em-term.el (eshell-term-send-raw-string)
* lisp/eshell/esh-mode.el (eshell-self-insert-command)
(eshell-send-input, eshell-send-invisible):
Use 'eshell-head-process'.
* lisp/eshell/esh-cmd.el (eshell-as-subcommand):
Use 'eshell-tail-process'.
* lisp/eshell/eshell.el (eshell-command):
* test/lisp/eshell/eshell-tests-helpers.el
(eshell-wait-for-subprocess):
Use 'eshell-interactive-process-p' and 'eshell-tail-process'.
* test/lisp/eshell/eshell-tests.el (eshell-test/pipe-headproc-stdin):
New test.
Diffstat (limited to 'lisp/eshell/esh-proc.el')
-rw-r--r-- | lisp/eshell/esh-proc.el | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 5ed692fb5a3..bb2136c06cc 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el @@ -101,6 +101,8 @@ information, for example." (defvar eshell-process-list nil "A list of the current status of subprocesses.") +(declare-function eshell-send-eof-to-process "esh-mode") + (defvar-keymap eshell-proc-mode-map "C-c M-i" #'eshell-insert-process "C-c C-c" #'eshell-interrupt-process @@ -542,14 +544,5 @@ See the variable `eshell-kill-processes-on-exit'." ; ;; `eshell-resume-eval'. ; (eshell-kill-process-function nil "continue"))) -(defun eshell-send-eof-to-process () - "Send EOF to process." - (interactive) - (require 'esh-mode) - (declare-function eshell-send-input "esh-mode" - (&optional use-region queue-p no-newline)) - (eshell-send-input nil nil t) - (eshell-process-interact 'process-send-eof)) - (provide 'esh-proc) ;;; esh-proc.el ends here |