expand-deps动态绑定
clojure.tools.deps.alpha.util.dir/the-dir在提交工作线程之前
线程。虽然难以重现,但 empirically breaks the
canonization of file paths from :local/root dependencies。
根据Clojure文档中的push-thread-bindings
WARNING: 这是一个低级函数。尽可能地偏好高级宏
绑定。 [...] 每个调用 MUST 都必须由一个匹配的
pop-thread-bindings调用包装在一个
try-finally!
bound-fn*确保动态绑定正确地推入和弹出。从submit-task中
使用它消除了:local/root canonicization问题。
.../clojure/clojure/tools/deps/alpha/util/concurrent.clj | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/main/clojure/clojure/tools/deps/alpha/util/concurrent.clj b/src/main/clojure/clojure/tools/deps/alpha/util/concurrent.clj
index b1508c10..814e0190 100644
--- a/src/main/clojure/clojure/tools/deps/alpha/util/concurrent.clj
+++ b/src/main/clojure/clojure/tools/deps/alpha/util/concurrent.clj
@@ -29,11 +29,7 @@
(defn submit-task
^Future [^ExecutorService executor f]
- (let [bindings (get-thread-bindings)
- task #(do
- (push-thread-bindings bindings)
- (f))]
- (.submit executor ^Callable task)))
+ (.submit executor ^Callable (bound-fn* f)))
(defn shutdown-on-error
[^ExecutorService executor]