Function: eshell-close-handles

eshell-close-handles is a byte-compiled function defined in esh-io.el.gz.

Signature

(eshell-close-handles &optional HANDLES)

Documentation

Close all of the current HANDLES, taking refcounts into account.

If HANDLES is nil, use eshell-current-handles.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-io.el.gz
(defun eshell-close-handles (&optional handles obsolete-1 obsolete-2)
  "Close all of the current HANDLES, taking refcounts into account.
If HANDLES is nil, use `eshell-current-handles'."
  (declare (advertised-calling-convention (&optional handles) "31.1"))
  (when (or obsolete-1 obsolete-2 (numberp handles))
    (declare-function eshell-set-exit-info "esh-cmd"
                      (&optional exit-code result))
    ;; In addition to setting the advertised calling convention, warn
    ;; if we get here.  A caller may have called with the right number
    ;; of arguments but the wrong type.
    (display-warning '(eshell close-handles)
                     "Called `eshell-close-handles' with obsolete arguments")
    ;; Here, HANDLES is really the exit code.
    (when (or handles obsolete-1)
      (eshell-set-exit-info (or handles 0) (cadr obsolete-1)))
    (setq handles obsolete-2))

  (let ((handles (or handles eshell-current-handles))
        (succeeded (eshell-exit-success-p)))
    (dotimes (idx eshell-number-of-handles)
      (eshell-close-handle (aref handles idx) succeeded))))