Function: eshell-insertion-filter
eshell-insertion-filter is a byte-compiled function defined in
esh-proc.el.gz.
Signature
(eshell-insertion-filter PROC STRING)
Documentation
Insert a string into the eshell buffer, or a process/file/buffer.
PROC is the process for which we're inserting output. STRING is the output.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-proc.el.gz
(defun eshell-insertion-filter (proc string)
"Insert a string into the eshell buffer, or a process/file/buffer.
PROC is the process for which we're inserting output. STRING is the
output."
(eshell-debug-command 'process
"received output from process `%s'\n\n%s" proc string)
(when (buffer-live-p (process-buffer proc))
(with-current-buffer (process-buffer proc)
(process-put proc :eshell-pending
(concat (process-get proc :eshell-pending)
string))
(if (process-get proc :eshell-busy)
(eshell-debug-command 'process "i/o busy for process `%s'" proc)
(unwind-protect
(let ((handles (process-get proc :eshell-handles))
(index (process-get proc :eshell-handle-index))
data)
(while (setq data (process-get proc :eshell-pending))
(process-put proc :eshell-pending nil)
(eshell-debug-command 'process
"forwarding output from process `%s'\n\n%s" proc data)
(condition-case nil
(eshell-output-object data index handles)
;; FIXME: We want to send SIGPIPE to the process
;; here. However, remote processes don't currently
;; support that, and not all systems have SIGPIPE in
;; the first place (e.g. MS Windows). In these
;; cases, just kill the process; this is
;; reasonably close to the right behavior, since the
;; default action for SIGPIPE is to terminate the
;; process. For use cases where SIGPIPE is truly
;; needed, using an external pipe operator (`*|')
;; may work instead (e.g. when working with remote
;; processes).
(eshell-pipe-broken
(if (or (process-get proc 'remote-pid)
(eq system-type 'windows-nt))
(kill-process proc)
(signal-process proc 'SIGPIPE))))))
(process-put proc :eshell-busy nil))))))