Skip to content

Commit

Permalink
Wait for all proc to complete before throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvincent committed Dec 3, 2024
1 parent 99a7542 commit 5fbf3dd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/kmono-build/src/k16/kmono/build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,17 @@
(.release semaphore)))))
stage)]

(mapv deref op-procs)
;; First deref everything, handling exceptions. This ensures that all
;; procs finish before any exceptions are thrown.
;;
;; Once all procs are complete then throw if any were exceptional.
(->> op-procs
(mapv (fn [proc]
(try
(deref proc)
(catch Exception ex ex))))
(run! (fn [val]
(when (instance? Exception val)
(throw val)))))

(recur (rest stages))))))))

0 comments on commit 5fbf3dd

Please sign in to comment.