From 6fe4d5993d3d9c5efe1c5e685da003d84ed132e5 Mon Sep 17 00:00:00 2001 From: Yoshi Sono Date: Thu, 1 Sep 2016 12:49:08 -0700 Subject: [PATCH] Check existence of known_hosts file --- src/clj_ssh/ssh.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/clj_ssh/ssh.clj b/src/clj_ssh/ssh.clj index d0ec38b..79136b1 100644 --- a/src/clj_ssh/ssh.clj +++ b/src/clj_ssh/ssh.clj @@ -146,7 +146,8 @@ (let [agent (JSch.)] (when use-system-ssh-agent (agent/connect agent)) - (when known-hosts-path + (when (and known-hosts-path + (.exists (io/file known-hosts-path))) (locking hosts-file (.setKnownHosts agent known-hosts-path))) agent))