bikeshed watch script
This commit is contained in:
parent
e2fee2f19a
commit
0b5ff3eab5
|
@ -12,9 +12,11 @@
|
|||
|
||||
(define (watch-forever file)
|
||||
(sleep 0.2)
|
||||
(define chg-evt (filesystem-change-evt file (lambda ()
|
||||
(match (filesystem-change-evt file (λ () #f))
|
||||
[#f
|
||||
(displayln "error watching file...")
|
||||
(sleep 1) (watch-forever file))))
|
||||
(sleep 1)]
|
||||
[chg-evt
|
||||
(define runner (thread (lambda () (reinvoke file))))
|
||||
|
||||
(define (handle-break _)
|
||||
|
@ -29,7 +31,7 @@
|
|||
|
||||
(with-handlers ([exn:break? handle-break])
|
||||
(sync chg-evt)
|
||||
(kill-thread runner))
|
||||
(kill-thread runner))])
|
||||
(watch-forever file))
|
||||
|
||||
(define-runtime-path aoc "aoc.rkt")
|
||||
|
|
Loading…
Reference in New Issue