Function: eshell-term-sentinel
eshell-term-sentinel is a byte-compiled function defined in
em-term.el.gz.
Signature
(eshell-term-sentinel PROC MSG)
Documentation
Clean up the buffer visiting PROC.
If eshell-destroy-buffer-when-process-dies is non-nil, destroy
the buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-term.el.gz
;; Process sentinels receive two arguments.
(defun eshell-term-sentinel (proc msg)
"Clean up the buffer visiting PROC.
If `eshell-destroy-buffer-when-process-dies' is non-nil, destroy
the buffer."
(term-sentinel proc msg) ;; First call the normal term sentinel.
(when eshell-destroy-buffer-when-process-dies
(let ((proc-buf (process-buffer proc)))
(when (and proc-buf (buffer-live-p proc-buf)
(not (eq 'run (process-status proc)))
(= (process-exit-status proc) 0))
(if (eq (current-buffer) proc-buf)
(let ((buf (and (boundp 'eshell-parent-buffer)
eshell-parent-buffer
(buffer-live-p eshell-parent-buffer)
eshell-parent-buffer)))
(if buf
(switch-to-buffer buf))))
(kill-buffer proc-buf)))))