Function: eshell-watch-for-password-prompt

eshell-watch-for-password-prompt is a byte-compiled function defined in esh-mode.el.gz.

Signature

(eshell-watch-for-password-prompt)

Documentation

Prompt in the minibuffer for password and send without echoing.

This function uses eshell-send-invisible to read and send a password to the buffer's process if STRING contains a password prompt defined by eshell-password-prompt-regexp.

This function could be in the list eshell-output-filter-functions.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-mode.el.gz
(defun eshell-watch-for-password-prompt ()
  "Prompt in the minibuffer for password and send without echoing.
This function uses `eshell-send-invisible' to read and send a password to the
buffer's process if STRING contains a password prompt defined by
`eshell-password-prompt-regexp'.

This function could be in the list `eshell-output-filter-functions'."
  (when (eshell-head-process)
    (save-excursion
      (goto-char (max eshell-last-output-block-begin
                      (- eshell-last-output-end
                         eshell-password-prompt-max-length)))
      (when (let ((case-fold-search t))
              (re-search-forward eshell-password-prompt-regexp
                                 eshell-last-output-end t))
        ;; Use `run-at-time' in order not to pause execution of the
        ;; process filter with a minibuffer.
        (run-at-time
         0 nil
         (lambda (current-buf)
           (with-current-buffer current-buf
             (eshell-send-invisible)))
         (current-buffer))))))