File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 132
132
(satisfies? protocols/Session x))
133
133
134
134
; ;; Agent
135
+ (def ^:private hosts-file
136
+ " Something to lock to tray and prevent concurrent updates/reads to
137
+ hosts file."
138
+ (Object. ))
139
+
135
140
(defn ssh-agent
136
141
" Create a ssh-agent. By default a system ssh-agent is preferred."
137
142
[{:keys [use-system-ssh-agent ^String known-hosts-path]
142
147
(when use-system-ssh-agent
143
148
(agent/connect agent))
144
149
(when known-hosts-path
145
- (.setKnownHosts agent known-hosts-path))
150
+ (locking hosts-file
151
+ (.setKnownHosts agent known-hosts-path)))
146
152
agent))
147
153
148
154
; ;; Identities
@@ -391,9 +397,11 @@ keys. All other option key pairs will be passed as SSH config options."
391
397
(defn connect
392
398
" Connect a session."
393
399
([session]
394
- (protocols/connect session))
400
+ (locking hosts-file
401
+ (protocols/connect session)))
395
402
([session timeout]
396
- (protocols/connect session timeout)))
403
+ (locking hosts-file
404
+ (protocols/connect session timeout))))
397
405
398
406
(defn disconnect
399
407
" Disconnect a session."
You can’t perform that action at this time.
0 commit comments