Skip to content

Commit a3cb965

Browse files
committed
Fix beholder watch functionality. Improve docs.
1 parent 49e98ed commit a3cb965

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
## Fixed
66

7+
- Fix beholder watch functionality that would cause a NullPointerException earlier.
8+
79
## Changed
810

911
# 1.91.1392 (2024-05-23 / c2d7e1f)

doc/07_watch_mode.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ interface, the provided links describes how they work in detail.
3434

3535
``` clojure
3636
#kaocha/v1
37-
{:kaocha.watch/ignore ["*.tmp"]}
37+
{:kaocha.watch/ignore ["**.tmp"]}
38+
; this will match all files ending in .tmp in the current directory and
39+
; any subdirectory
3840
```
3941

4042
When running in watch mode you can press the Enter (Return) key to manually

src/kaocha/watch.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
[lambdaisland.tools.namespace.track :as ctn-track]
2323
[slingshot.slingshot :refer [try+]]
2424
[nextjournal.beholder :as beholder])
25-
(:import (java.nio.file FileSystems)
25+
(:import (java.nio.file FileSystems Path)
2626
(java.util.concurrent ArrayBlockingQueue BlockingQueue)))
2727

2828
(defn make-queue []
@@ -93,6 +93,7 @@
9393
for a description of the patterns, these are similar but not the same as
9494
typical shell glob patterns."
9595
[path patterns]
96+
(assert (instance? Path path))
9697
(let [fs (FileSystems/getDefault)
9798
patterns (map #(.getPathMatcher fs (str "glob:" %)) patterns)]
9899
(some #(.matches % path) patterns)))
@@ -295,8 +296,9 @@ errors as test errors."
295296
(defmethod watch! :beholder [{:keys [q watch-paths]}]
296297
(apply beholder/watch
297298
(fn [{:keys [type path]}]
299+
(assert (instance? Path path))
298300
(when (contains? #{:modify :create} type)
299-
(qput q path)))
301+
(qput q (.toFile path))))
300302
(map str watch-paths)))
301303

302304
(defn run* [config finish? q]

0 commit comments

Comments
 (0)