From 5b112482fbdb0351487a7af592ae901e20ec45c1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 2 Jul 2022 14:21:00 +0200 Subject: [PATCH] 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-&'.) --- lisp/comint.el | 5 +++-- 1 file 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 -- 2.39.2