(define-obsolete-function-alias 'send-invisible #'comint-send-invisible "27.1")
+(defvar comint--prompt-recursion-depth 0)
+
(defun comint-watch-for-password-prompt (string)
"Prompt in the minibuffer for password and send without echoing.
Looks for a match to `comint-password-prompt-regexp' in order
(string-match comint-password-prompt-regexp string))
(when (string-match "^[ \n\r\t\v\f\b\a]+" string)
(setq string (replace-match "" t t string)))
- (comint-send-invisible string)))
+ (let ((comint--prompt-recursion-depth (1+ comint--prompt-recursion-depth)))
+ (if (> comint--prompt-recursion-depth 10)
+ (message "Password prompt recursion too deep")
+ (comint-send-invisible string)))))
\f
;; Low-level process communication