Add some error-handling when adding SSH keyfiles
This commit is contained in:
parent
45c3b61476
commit
bbb75c7b46
@ -844,9 +844,13 @@ for KEY-FILE; PASSWORD-FN is called on demand.
|
|||||||
|
|
||||||
This function uses ssh-add to add the key to the currently
|
This function uses ssh-add to add the key to the currently
|
||||||
running ssh-agent and waits for the process to finish."
|
running ssh-agent and waits for the process to finish."
|
||||||
|
(let ((key-file (expand-file-name key-file)))
|
||||||
|
|
||||||
|
(unless (file-readable-p key-file)
|
||||||
|
(user-error "SSH key %s does not exist, aborting" key-file))
|
||||||
|
|
||||||
(with-environment-variables (("SSH_ASKPASS_REQUIRE" "never"))
|
(with-environment-variables (("SSH_ASKPASS_REQUIRE" "never"))
|
||||||
(let* ((key-file (expand-file-name key-file))
|
(let ((proc (make-process :name "ssh-add"
|
||||||
(proc (make-process :name "ssh-add"
|
|
||||||
:buffer nil
|
:buffer nil
|
||||||
:command (list "ssh-add" key-file)
|
:command (list "ssh-add" key-file)
|
||||||
:filter #'(lambda (process output)
|
:filter #'(lambda (process output)
|
||||||
@ -875,7 +879,7 @@ running ssh-agent and waits for the process to finish."
|
|||||||
;; intermingle with others. XXX: is there a more standard way to wait for
|
;; intermingle with others. XXX: is there a more standard way to wait for
|
||||||
;; a process to finish?
|
;; a process to finish?
|
||||||
(while (process-live-p proc)
|
(while (process-live-p proc)
|
||||||
(sit-for 0.2)))))
|
(sit-for 0.2))))))
|
||||||
|
|
||||||
(defun db/ssh-key-hash-from-filename (key-file)
|
(defun db/ssh-key-hash-from-filename (key-file)
|
||||||
"Return the SHA256 hash value of the SSH key located in KEY-FILE.
|
"Return the SHA256 hash value of the SSH key located in KEY-FILE.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user