Skip to content

Commit 44549bc

Browse files
docker/lsp:treesitter was not being pulled automatically
* this was only showing up in single file mode
1 parent e32fc06 commit 44549bc

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

src/docker.clj

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,17 @@
196196
(spec/def ::container-definition (spec/keys :opt-un [::host-dir ::entrypoint ::command ::user ::pat]
197197
:req-un [::image]))
198198

199-
(defn run-function [{:keys [timeout] :or {timeout 600000} :as m}]
199+
(defn- -pull [m]
200200
(pull (merge m
201201
{:serveraddress "https://index.docker.io/v1/"}
202202
(let [jwt (creds/credential-helper->jwt)]
203203
(when (and (:user m)
204204
(or (:pat m) jwt))
205205
{:creds {:username (:user m)
206-
:password (or (:pat m) jwt)}}))))
206+
:password (or (:pat m) jwt)}})))))
207+
208+
(defn run-function [{:keys [timeout] :or {timeout 600000} :as m}]
209+
(-pull m)
207210
(let [x (create m)
208211
finished-channel (async/promise-chan)]
209212
(start x)
@@ -214,7 +217,7 @@
214217
:done :timeout
215218
:kill-container (kill-container x)}))
216219
;; watch the container
217-
(async/go
220+
(async/go
218221
(wait x)
219222
(async/>! finished-channel {:done :exited}))
220223

@@ -224,10 +227,10 @@
224227
info (inspect x)]
225228
(delete x)
226229
(merge
227-
finish-reason
228-
{:pty-output s
229-
:exit-code (-> info :State :ExitCode)
230-
:info info}))))
230+
finish-reason
231+
{:pty-output s
232+
:exit-code (-> info :State :ExitCode)
233+
:info info}))))
231234

232235
(def extract-facts run-function)
233236

@@ -252,15 +255,16 @@
252255
(defn docker-stream-format->stdout [bytes]
253256
;; use xxd to look at the bytes
254257
#_(try
255-
(with-open [w (java.io.BufferedOutputStream.
256-
(java.io.FileOutputStream. "hey.txt"))]
257-
(.write w bytes))
258-
259-
(catch Throwable t
260-
(println t)))
258+
(with-open [w (java.io.BufferedOutputStream.
259+
(java.io.FileOutputStream. "hey.txt"))]
260+
(.write w bytes))
261+
262+
(catch Throwable t
263+
(println t)))
261264
(String. (Arrays/copyOfRange bytes 8 (count bytes))))
262265

263266
(defn function-call-with-stdin [m]
267+
(-pull m)
264268
(let [x (merge
265269
m
266270
(create (assoc m
@@ -276,9 +280,9 @@
276280
(.close (:socket x))
277281
(wait x)
278282
;; body is raw PTY output
279-
(let [s (docker-stream-format->stdout
280-
(:body
281-
(attach-container-stdout-logs x)) )
283+
(let [s (docker-stream-format->stdout
284+
(:body
285+
(attach-container-stdout-logs x)))
282286
info (inspect x)]
283287
(delete x)
284288
{:pty-output s
@@ -295,11 +299,11 @@
295299
:user "jimclark106")) keyword))
296300
(docker/delete-image {:image "vonwig/go-linguist:latest"})
297301
(pprint
298-
(extract-facts {:image "vonwig/go-linguist:latest"
299-
:timeout 100
300-
:command ["-json"]
301-
:host-dir "/Users/slim/docker/labs-make-runbook"
302-
:user "jimclark106"}))
302+
(extract-facts {:image "vonwig/go-linguist:latest"
303+
:timeout 100
304+
:command ["-json"]
305+
:host-dir "/Users/slim/docker/labs-make-runbook"
306+
:user "jimclark106"}))
303307
(pprint
304308
(json/parse-string
305309
(extract-facts

0 commit comments

Comments
 (0)