commit 8fa3443923f07d2ab41d13aef908d717b55355b9
parent 8091e207b61c7c1e58ae27643c30b0c77b7e7669
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 30 Jul 2024 17:37:38 +0100
Revert "anoia.svc use timeout for inotify"
This reverts commit eca8e37e7aeae88525230804a711659f6c0b5dc4.
Diffstat:
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/pkgs/anoia/svc.fnl b/pkgs/anoia/svc.fnl
@@ -1,14 +1,13 @@
(local inotify (require :inotify))
(local { : file-exists? } (require :anoia))
(local { : file-type : dir &as fs } (require :anoia.fs))
-(local ll (require :lualinux))
(fn read-line [name]
(with-open [f (assert (io.open name :r) (.. "can't open file " name))]
(f:read "*l")))
(fn watch-fsevents [directory-name]
- (let [handle (inotify.init { :blocking false})]
+ (let [handle (inotify.init)]
(handle:addwatch directory-name
inotify.IN_CREATE
inotify.IN_MOVE
@@ -40,16 +39,11 @@
(coroutine.yield self)
(self:wait))))
-(fn read-with-timeout [watcher]
- (let [fd (watcher:fileno)]
- (ll.pollin fd 5000)
- (watcher:read)))
-
(fn open [directory]
(let [watcher (watch-fsevents directory)
has-file? (fn [filename] (file-exists? (.. directory "/" filename)))]
{
- :wait #(read-with-timeout watcher)
+ :wait #(watcher:read)
:ready? (fn [self]
(and (has-file? "state") (not (has-file? ".lock"))))
:output (fn [_ filename]