[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a6f156a: *-watch-for-password-prompt: Use run-at-time to read pas
From: |
Lars Ingebrigtsen |
Subject: |
master a6f156a: *-watch-for-password-prompt: Use run-at-time to read password |
Date: |
Mon, 18 Oct 2021 09:26:15 -0400 (EDT) |
branch: master
commit a6f156a7b03e410c044ad96f1ba16645d451c083
Author: Miha Rihtaršič <miha@kamnitnik.top>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
*-watch-for-password-prompt: Use run-at-time to read password
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/eshell/esh-mode.el (eshell-watch-for-password-prompt):
* lisp/term.el (term-watch-for-password-prompt):
Use run-at-time to read a password (bug#51263).
---
lisp/comint.el | 18 +++++++++++++-----
lisp/eshell/esh-mode.el | 9 ++++++++-
lisp/term.el | 9 ++++++++-
3 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/lisp/comint.el b/lisp/comint.el
index a0873c0..e925b3a 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2455,11 +2455,19 @@ This function could be in the list
`comint-output-filter-functions'."
(when (let ((case-fold-search t))
(string-match comint-password-prompt-regexp
(string-replace "\r" "" 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-trim string "[ \n\r\t\v\f\b\a]+" "\n+"))))))
+ ;; 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
+ (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-trim string "[ \n\r\t\v\f\b\a]+" "\n+"))))))
+ (current-buffer))))
;; Low-level process communication
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 98e8903..579b01f 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -940,7 +940,14 @@ This function could be in the list
`eshell-output-filter-functions'."
(beginning-of-line)
(if (re-search-forward eshell-password-prompt-regexp
eshell-last-output-end t)
- (eshell-send-invisible))))))
+ ;; 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)))))))
(custom-add-option 'eshell-output-filter-functions
'eshell-watch-for-password-prompt)
diff --git a/lisp/term.el b/lisp/term.el
index dd54577..530b934 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -2409,7 +2409,14 @@ Checks if STRING contains a password prompt as defined by
(when (term-in-line-mode)
(when (let ((case-fold-search t))
(string-match comint-password-prompt-regexp string))
- (term-send-invisible (read-passwd string)))))
+ ;; 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
+ (term-send-invisible (read-passwd string))))
+ (current-buffer)))))
;;; Low-level process communication
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a6f156a: *-watch-for-password-prompt: Use run-at-time to read password,
Lars Ingebrigtsen <=