Function: eshell-sentinel
eshell-sentinel is a byte-compiled function defined in esh-proc.el.gz.
Signature
(eshell-sentinel PROC STRING)
Documentation
Generic sentinel for command processes. Reports only signals.
PROC is the process that's exiting. STRING is the exit message.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-proc.el.gz
(defun eshell-sentinel (proc string)
"Generic sentinel for command processes. Reports only signals.
PROC is the process that's exiting. STRING is the exit message."
(when (buffer-live-p (process-buffer proc))
(with-current-buffer (process-buffer proc)
(unwind-protect
(unless (string= string "run")
;; Write the exit message if the status is abnormal and
;; the process is already writing to the terminal.
(when (and (eq proc (eshell-tail-process))
(not (string-match "^\\(finished\\|exited\\)"
string)))
(funcall (process-filter proc) proc string))
(let* ((handles (process-get proc :eshell-handles))
(index (process-get proc :eshell-handle-index))
(data (process-get proc :eshell-pending))
;; Only get the status for the primary subprocess,
;; not the pipe process (if any).
(status (when (= index eshell-output-handle)
(process-exit-status proc))))
(process-put proc :eshell-pending nil)
;; If we're in the middle of handling output from this
;; process then schedule the EOF for later.
(letrec ((finish-io
(lambda ()
(if (process-get proc :eshell-busy)
(run-at-time 0 nil finish-io)
(when data
(ignore-error 'eshell-pipe-broken
(eshell-output-object
data index handles)))
(eshell-close-handles
status
(when status (list 'quote (= status 0)))
handles)))))
(funcall finish-io))))
(when-let ((entry (assq proc eshell-process-list)))
(eshell-remove-process-entry entry))
(eshell-kill-process-function proc string)))))