Compare commits
1 Commits
53a9ede65c
...
bbb75c7b46
| Author | SHA1 | Date | |
|---|---|---|---|
| bbb75c7b46 |
@ -840,8 +840,7 @@ This is `db-light' and `solarized-light'."
|
||||
"Synchronously add key in KEY-FILE to currently running ssh-agent.
|
||||
|
||||
PASSWORD-FN is supposed to be a function returning the password
|
||||
for KEY-FILE; PASSWORD-FN is called on demand. If KEY-FILE is
|
||||
not readable, this function errors out.
|
||||
for KEY-FILE; PASSWORD-FN is called on demand.
|
||||
|
||||
This function uses ssh-add to add the key to the currently
|
||||
running ssh-agent and waits for the process to finish."
|
||||
@ -851,8 +850,10 @@ running ssh-agent and waits for the process to finish."
|
||||
(user-error "SSH key %s does not exist, aborting" key-file))
|
||||
|
||||
(with-environment-variables (("SSH_ASKPASS_REQUIRE" "never"))
|
||||
|
||||
(let* ((ssh-add-handle-output #'(lambda (process output)
|
||||
(let ((proc (make-process :name "ssh-add"
|
||||
:buffer nil
|
||||
:command (list "ssh-add" key-file)
|
||||
:filter #'(lambda (process output)
|
||||
(cond
|
||||
((string= (format "Enter passphrase for %s: "
|
||||
key-file)
|
||||
@ -865,23 +866,15 @@ running ssh-agent and waits for the process to finish."
|
||||
(string= output "\n"))
|
||||
;; Ignore harmless output
|
||||
t)
|
||||
(t (message "Unknown output received from ssh-agent: %s" output)))))
|
||||
|
||||
(ssh-add-handle-event-change #'(lambda (_ event)
|
||||
(t (message "Unknown output received from ssh-agent: %s" output))))
|
||||
:sentinel #'(lambda (_ event)
|
||||
(cond
|
||||
((string= event "finished\n")
|
||||
(message "Successfully added %s to local SSH agent"
|
||||
key-file))
|
||||
(t (message "Adding SSH key %s failed, ssh-add process reached state %s"
|
||||
key-file
|
||||
event)))))
|
||||
|
||||
(proc (make-process :name "ssh-add"
|
||||
:buffer nil
|
||||
:command (list "ssh-add" key-file)
|
||||
:filter ssh-add-handle-output
|
||||
:sentinel ssh-add-handle-event-change)))
|
||||
|
||||
event)))))))
|
||||
;; We are waiting for the process to finish, to not let its output
|
||||
;; intermingle with others. XXX: is there a more standard way to wait for
|
||||
;; a process to finish?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user