Function: eshell-do-pipelines

eshell-do-pipelines is a macro defined in esh-cmd.el.gz.

Signature

(eshell-do-pipelines PIPELINE &optional NOTFIRST)

Documentation

Execute the commands in PIPELINE, connecting each to one another.

Returns a list of the processes in the pipeline.

This macro calls itself recursively, with NOTFIRST non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defmacro eshell-do-pipelines (pipeline &optional notfirst)
  "Execute the commands in PIPELINE, connecting each to one another.
Returns a list of the processes in the pipeline.

This macro calls itself recursively, with NOTFIRST non-nil."
  (when (setq pipeline (cadr pipeline))
    (eshell--unmark-deferrable (car pipeline))
    `(eshell-with-copied-handles
      (let ((next-procs
             ,(when (cdr pipeline)
                `(eshell-do-pipelines (quote ,(cdr pipeline)) t)))
            ;; First and last elements in a pipeline may need special
            ;; treatment (currently only `eshell-ls-files' uses
            ;; `last').  Affects `process-connection-type' in
            ;; `eshell-gather-process-output'.
            (eshell-in-pipeline-p
             ,(cond ((not notfirst) (quote 'first))
                    ((cdr pipeline) t)
                    (t (quote 'last)))))
        ,(when (cdr pipeline)
           `(eshell-set-output-handle ,eshell-output-handle
                                      'append (car next-procs)))
        (let ((proc ,(car pipeline)))
          (cons proc next-procs)))
      ;; Steal handles if this is the last item in the pipeline.
      ,(null (cdr pipeline)))))