]> git.eshelyaron.com Git - emacs.git/commitdiff
Make comint-watch-for-password-prompt more resilient
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 2 Jul 2022 12:21:00 +0000 (14:21 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 2 Jul 2022 12:21:00 +0000 (14:21 +0200)
* 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

index 3da61fb992f540df81c39bffc355eebfe150a72e..92262eab32134324f638ae4790ea8a9a31da2112 100644 (file)
@@ -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))))
 \f
 ;; Low-level process communication