Function: eshell-close-target
eshell-close-target is a byte-compiled function defined in
esh-io.el.gz.
Signature
(eshell-close-target TARGET STATUS)
Documentation
Close an output TARGET, passing STATUS as the result.
STATUS should be non-nil on successful termination of the output.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-io.el.gz
(defun eshell-close-target (target status)
"Close an output TARGET, passing STATUS as the result.
STATUS should be non-nil on successful termination of the output."
(cond
((symbolp target) nil)
;; If we were redirecting to a file, save the file and close the
;; buffer.
((markerp target)
(let ((buf (marker-buffer target)))
(when buf ; somebody's already killed it!
(save-current-buffer
(set-buffer buf)
(when eshell-output-file-buffer
(save-buffer)
(when (eq eshell-output-file-buffer t)
(or status (set-buffer-modified-p nil))
(kill-buffer buf)))))))
;; If we're redirecting to a process (via a pipe, or process
;; redirection), send it EOF so that it knows we're finished.
((eshell-processp target)
(if (eq (process-status target) 'run)
(process-send-eof target)))
;; A plain function redirection needs no additional arguments
;; passed.
((functionp target)
(funcall target status))
;; But a more complicated function redirection (which can only
;; happen with aliases at the moment) has arguments that need to be
;; passed along with it.
((consp target)
(apply (car target) status (cdr target)))))