summaryrefslogtreecommitdiff
path: root/haunt
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2022-02-06 16:40:45 -0500
committerDavid Thompson <dthompson2@worcester.edu>2022-02-06 16:40:45 -0500
commit1a91f3d0568fc095d8b0875c6553ef15b76efa4c (patch)
tree693da914f9d9ec66d17583dd005624b092fdcbe4 /haunt
parent7d0b71f6a3f0e714da5a5c43e52408e27f44c383 (diff)
ui: serve: Fix lazy loading of inotify module.
Diffstat (limited to 'haunt')
-rw-r--r--haunt/ui/serve.scm22
1 files changed, 13 insertions, 9 deletions
diff --git a/haunt/ui/serve.scm b/haunt/ui/serve.scm
index 8511d87..8abe0c6 100644
--- a/haunt/ui/serve.scm
+++ b/haunt/ui/serve.scm
@@ -89,17 +89,21 @@ Start an HTTP server for the current site.~%")
;; TODO: Detect new directories and watch them, too.
(define (watch/linux config-file check-dir? check-file?)
- ;; Lazy load inotify procedures. Requiring the module in the
+ ;; Lazy load inotify module. Requiring the module in the
;; define-module definition would cause crashes on non-Linux
;; platforms where the FFI cannot bind to inotify functions.
- (define make-inotify (@ (haunt inotify) make-inotify))
- (define inotify-add-watch! (@ (haunt inotify) inotify-add-watch!))
- (define inotify-pending-events? (@ (haunt inotify) inotify-pending-events?))
- (define inotify-read-event (@ (haunt inotify) inotify-read-event))
- (define inotify-watch-file-name (@ (haunt inotify) inotify-watch-file-name))
- (define inotify-event-watch (@ (haunt inotify) inotify-event-watch))
- (define inotify-event-file-name (@ (haunt inotify) inotify-event-file-name))
- (define inotify-event-type (@ (haunt inotify) inotify-event-type))
+ (define inotify-module (resolve-module '(haunt inotify)))
+ (define make-inotify (module-ref inotify-module 'make-inotify))
+ (define inotify-add-watch! (module-ref inotify-module 'inotify-add-watch!))
+ (define inotify-pending-events?
+ (module-ref inotify-module 'inotify-pending-events?))
+ (define inotify-read-event (module-ref inotify-module 'inotify-read-event))
+ (define inotify-watch-file-name
+ (module-ref inotify-module 'inotify-watch-file-name))
+ (define inotify-event-watch (module-ref inotify-module 'inotify-event-watch))
+ (define inotify-event-file-name
+ (module-ref inotify-module 'inotify-event-file-name))
+ (define inotify-event-type (module-ref inotify-module 'inotify-event-type))
(let ((inotify (make-inotify)))
(define (no-op name stat result) result)
(define (watch-directory name stat result)