diff options
-rw-r--r-- | src/data/ssh-askpass.lisp | 9 | ||||
-rw-r--r-- | src/package.lisp | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/data/ssh-askpass.lisp b/src/data/ssh-askpass.lisp index 6d644d9..e6ff0d7 100644 --- a/src/data/ssh-askpass.lisp +++ b/src/data/ssh-askpass.lisp @@ -26,10 +26,17 @@ using ssh-askpass(1) to prompt the user to input it. Useful for things like sudo passwords." (unless (uiop:getenv "DISPLAY") (missing-data-source "DISPLAY not set; cannot launch ssh-askpass(1).")) + ;; This cache duplicates CONSFIGURATOR::*STRING-DATA*, but if we don't keep + ;; our own cache here, then we would always have to return the current time + ;; from the first closure, and then we'd prompt the user for input every + ;; time, bypassing CONSFIGURATOR::*STRING-DATA*. (let ((cache (make-hash-table :test #'equal))) (cons (lambda (iden1 iden2) - (and (re:scan iden1-re iden1) (re:scan iden2-re iden2))) + (and (re:scan iden1-re iden1) + (re:scan iden2-re iden2) + (if-let ((cached (gethash (cons iden1 iden2) cache))) + (data-version cached) (get-universal-time)))) (lambda (iden1 iden2) (let ((pair (cons iden1 iden2))) (or (gethash pair cache) diff --git a/src/package.lisp b/src/package.lisp index 0334b66..091a84a 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -538,5 +538,5 @@ (:use #:cl #:consfigurator)) (defpackage :consfigurator.data.ssh-askpass - (:use #:cl #:consfigurator) + (:use #:cl #:alexandria #:consfigurator) (:local-nicknames (#:re #:cl-ppcre))) |