Function: eshell-wait-for-processes

eshell-wait-for-processes is a byte-compiled function defined in esh-proc.el.gz.

Signature

(eshell-wait-for-processes &optional PROCS TIMEOUT)

Documentation

Wait until PROCS have completed execution.

If TIMEOUT is non-nil, wait at most that many seconds. Return non-nil if all the processes finished executing before the timeout expired.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-proc.el.gz
(defun eshell-wait-for-processes (&optional procs timeout)
  "Wait until PROCS have completed execution.
If TIMEOUT is non-nil, wait at most that many seconds.  Return non-nil
if all the processes finished executing before the timeout expired."
  (let ((expiration (when timeout (time-add (current-time) timeout))))
    (catch 'timeout
      (dolist (proc procs)
        (while (if (processp proc)
                   (eshell-process-active-p proc)
                 (process-attributes proc))
          (when (input-pending-p)
            (discard-input))
          (when (and expiration
                     (not (time-less-p (current-time) expiration)))
            (throw 'timeout nil))
          (sit-for eshell-process-wait-time)))
      t)))