summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-07-02 14:21:00 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-07-02 14:21:00 +0200
commit5b112482fbdb0351487a7af592ae901e20ec45c1 (patch)
tree1e4471c137fd027b7598588f5ce87acbf4a7248c /lisp/comint.el
parent8d68760ddee3690b4312fdb5d85210cb21b4eb7d (diff)
downloademacs-5b112482fbdb0351487a7af592ae901e20ec45c1.tar.gz
Make comint-watch-for-password-prompt more resilient
* lisp/comint.el (comint-watch-for-password-prompt): Don't try to send commands to the process after it's exited (bug#56336). (This commonly happens when invoked via `M-&'.)
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 3da61fb992f..92262eab321 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2515,8 +2515,9 @@ This function could be in the list `comint-output-filter-functions'."
(1+ comint--prompt-recursion-depth)))
(if (> comint--prompt-recursion-depth 10)
(message "Password prompt recursion too deep")
- (comint-send-invisible
- (string-trim string "[ \n\r\t\v\f\b\a]+" "\n+"))))))
+ (when (get-buffer-process (current-buffer))
+ (comint-send-invisible
+ (string-trim string "[ \n\r\t\v\f\b\a]+" "\n+")))))))
(current-buffer))))
;; Low-level process communication