diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b5dfcb2..f2a55f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## Fixed +- Fix beholder watch functionality that would cause a NullPointerException earlier. + ## Changed # 1.91.1392 (2024-05-23 / c2d7e1f) diff --git a/doc/07_watch_mode.md b/doc/07_watch_mode.md index e715cc83..b27de744 100644 --- a/doc/07_watch_mode.md +++ b/doc/07_watch_mode.md @@ -34,7 +34,9 @@ interface, the provided links describes how they work in detail. ``` clojure #kaocha/v1 -{:kaocha.watch/ignore ["*.tmp"]} +{:kaocha.watch/ignore ["**.tmp"]} +; this will match all files ending in .tmp in the current directory and +; any subdirectory ``` When running in watch mode you can press the Enter (Return) key to manually diff --git a/src/kaocha/watch.clj b/src/kaocha/watch.clj index 2da8ba71..82a31e49 100644 --- a/src/kaocha/watch.clj +++ b/src/kaocha/watch.clj @@ -22,7 +22,7 @@ [lambdaisland.tools.namespace.track :as ctn-track] [slingshot.slingshot :refer [try+]] [nextjournal.beholder :as beholder]) - (:import (java.nio.file FileSystems) + (:import (java.nio.file FileSystems Path) (java.util.concurrent ArrayBlockingQueue BlockingQueue))) (defn make-queue [] @@ -93,6 +93,7 @@ for a description of the patterns, these are similar but not the same as typical shell glob patterns." [path patterns] + (assert (instance? Path path)) (let [fs (FileSystems/getDefault) patterns (map #(.getPathMatcher fs (str "glob:" %)) patterns)] (some #(.matches % path) patterns))) @@ -295,8 +296,9 @@ errors as test errors." (defmethod watch! :beholder [{:keys [q watch-paths]}] (apply beholder/watch (fn [{:keys [type path]}] + (assert (instance? Path path)) (when (contains? #{:modify :create} type) - (qput q path))) + (qput q (.toFile path)))) (map str watch-paths))) (defn run* [config finish? q]