Function: eshell-eval-command

eshell-eval-command is a byte-compiled function defined in esh-cmd.el.gz.

Signature

(eshell-eval-command COMMAND &optional INPUT)

Documentation

Evaluate the given COMMAND iteratively.

Return the process (or head and tail processes) created by COMMAND, if any. If COMMAND is a background command, return the process(es) in a cons cell like:

  (:eshell-background . PROCESSES)

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-cmd.el.gz
(defun eshell-eval-command (command &optional input)
  "Evaluate the given COMMAND iteratively.
Return the process (or head and tail processes) created by
COMMAND, if any.  If COMMAND is a background command, return the
process(es) in a cons cell like:

  (:eshell-background . PROCESSES)"
  (if eshell-foreground-command
      (progn
        ;; We can just stick the new command at the end of the current
        ;; one, and everything will happen as it should.
        (setcdr (last (cdar eshell-foreground-command))
                (list `(let ((here (and (eobp) (point))))
                         ,(and input
                               `(insert-and-inherit ,(concat input "\n")))
                         (if here
                             (eshell-update-markers here))
                         (eshell-do-eval ',command))))
        (eshell-debug-command 'form
          "enqueued command form for %S\n\n%s"
          (or input "<no string>")
          (eshell-stringify (car eshell-foreground-command))))
    (eshell-debug-command-start input)
    (let* (result
           (delim (catch 'eshell-incomplete
                    (ignore (setq result (eshell-resume-eval
                                          (eshell-add-command command)))))))
      (when delim
        (error "Unmatched delimiter: %S" delim))
      result)))