Commit graph

108 commits

Author SHA1 Message Date
82344d475b
refactor: enable linux background read thread by default 2026-03-08 09:49:25 +01:00
5502f8940a
feat: add support for a background read thread in linux too 2026-03-08 09:49:03 +01:00
1cbbdbd3cb
docs: add a basic manual test script for windows 2026-03-08 09:22:49 +01:00
7851312cfe
fix(windows): more cross platform path join to fix tests on windows 2026-03-08 09:22:32 +01:00
8491389023
fix(windows): use cross platform path join to fix tests on windows 2026-03-07 21:38:11 +01:00
24a3537ef8
fix(windows): use proper temp dir for testing on windows 2026-03-07 21:37:19 +01:00
240f3f148f
fix(linux): prevent double delete notification on directories 2026-03-07 21:14:48 +01:00
d66fd9348a
docs: add simple manual test script 2026-03-07 21:12:30 +01:00
5deb3dfa8b
fix: don't resolve symlinks when making a relative path absolute
Using realpath() in watch() caused events to be emitted under the resolved
path (e.g. /private/tmp/...) rather than the path the caller provided (e.g.
/tmp/..., where /tmp is a symlink on macOS). This broke all integration
tests on macOS since the test file paths didn't match the emitted event
paths.

For absolute paths, use them unchanged. For relative paths, join with the
current working directory without further symlink resolution. This
preserves the caller's view of the path while still satisfying the kqueue
backend's requirement for absolute paths.
2026-03-07 20:49:03 +01:00
eab9b328ba
fix(kqueue): dangling stack pointer to full_path 2026-03-07 20:34:32 +01:00
db7d954a50
fix: automatically bump the kqueue file limit to the hard limit 2026-03-07 20:33:27 +01:00
8ad17f5189
fix: make sure paths are absolute before watching them 2026-03-07 20:32:13 +01:00
3554794234
fix(kqueue): add per-file watches to detect modifications and fix rename ordering
kqueue's NOTE_WRITE on a directory fires only when directory entries are
added or removed, not when file contents change. This meant writes to
existing files were never reported as 'modified' events on macOS/FreeBSD.

Fix by maintaining a second set of kqueue watches on individual files
(file_watches), registered with NOTE_WRITE|NOTE_EXTEND. When either flag
fires on a file fd, a 'modified' event is emitted. File watches are
registered in take_snapshot (for files already present when watch() is
called) and in scan_dir (for newly created files), and deregistered when
files are deleted or the directory is unwatched.

Also fix two related bugs:
- NOTE_DELETE was incorrectly defined as 0x04 (NOTE_EXTEND); the correct
  value is 0x01. This could cause NOTE_EXTEND events on watched directories
  to be misreported as directory-deleted events.
- scan_dir emitted created events before deleted events, so a rename
  (old name disappears, new name appears) reported the destination before
  the source. Swapped the order so deletions are always emitted first.

Simplify thread_fn/arm to pass *KQueueBackend directly now that the backend
lives at a stable heap address inside the heap-allocated Interceptor.

All 10 integration tests now pass on FreeBSD.
2026-03-07 20:18:05 +01:00
ae4b56b62a
fix: dangling interceptor crash 2026-03-07 20:02:40 +01:00
9b4d7c2121
feat: implement auto subdirectory watching for platforms that don't watch trees 2026-03-07 19:54:49 +01:00
9dda7efc25
refactor: add a little flair 2026-03-07 19:24:40 +01:00
4569a33382
fix: windows build 2026-03-07 19:20:30 +01:00
e4cc1b82fe
feat: add basic command line executable 2026-03-07 19:10:48 +01:00
f3463dd0dc
fix(kqueue): emit scan_dir events outside the snapshot lock
Handler callbacks invoked while holding snapshots_mutex could deadlock if
the handler called watch() or unwatch(), which also acquires that lock.
Refactor scan_dir to collect all pending events (dir_created, created,
deleted) into temporary lists under the lock, then emit them after
releasing it. Also consolidate the two directory iteration passes into one.
2026-03-07 18:19:00 +01:00
8dc759db61
fix: add a watches mutex to kqueue 2026-02-26 14:55:38 +01:00
9679b0cedf
fix: more test fixes 2026-02-26 14:47:38 +01:00
20c167b37d
build: install test executables
This makes cross compiled testing a little easier for now.
2026-02-26 14:47:07 +01:00
8af70c05b6
refactor: improve kqueue add_watch error handling 2026-02-26 14:21:19 +01:00
40d784bd9f
fix: add missing kqueue init handler 2026-02-26 14:13:17 +01:00
272e35b048
build: fix tests build 2026-02-26 14:10:29 +01:00
389082e4ac
build: fix lazy xcode-frameworks dep 2026-02-26 13:52:25 +01:00
f326b73457
build: make FSEvents backend optional and link it against xcode-frameworks 2026-02-26 13:49:01 +01:00
a720697618
build: add flags and xcode-frameworks deps 2026-02-26 13:42:14 +01:00
cf4ce5923a
fix: misc review findings 2026-02-26 13:37:59 +01:00
07fcb900f8 fix: macs build 2026-02-26 13:35:42 +01:00
f34fc3cb93
fix: FSEventsBackend.init 2026-02-26 13:11:39 +01:00
29a701154f
refactor: remove SpawnError 2026-02-26 13:09:44 +01:00
c6281d2433
fix: unwatch cannot error 2026-02-26 13:09:10 +01:00
2c4f752186
refactor: remove blocking mode for now 2026-02-26 13:07:34 +01:00
5df4aae786
refactor: clean-up in FSEventsBackend 2026-02-26 13:06:59 +01:00
92604f9be3
fix: inotify error handling in INotifyBackend.add_watch 2026-02-26 12:46:54 +01:00
4aae8f8b3e
refactor: add integration test suite 2026-02-26 12:46:15 +01:00
6cbf389d81
refactor: handler fixes 2026-02-26 10:26:00 +01:00
03e431c850
refactor: move to an independent handler model 2026-02-26 10:25:00 +01:00
a1e5e3e9a5
build: add initial zig package 2026-02-22 20:44:20 +01:00
db5b5217ba
fix: re-arm fd_watcher in handle_read_ready 2026-02-22 19:51:36 +01:00
a4abfaea80
refactor: add watches for newly created directories 2026-02-22 19:51:36 +01:00
b8e046d26a
refactor: re-work windows backend to direct send notifications 2026-02-22 19:51:36 +01:00
e9ef810d81
refactor: re-write FSEvents backend to use FSEventStreamSetDispatchQueue 2026-02-22 19:51:36 +01:00
b6d3780283
refactor: add directory snapshotting and diffing to kqueue backend 2026-02-22 19:51:35 +01:00
a6c6aeeb4b
refactor: drop watcher Backend.threaded 2026-02-22 19:51:35 +01:00
ad4b69915c
refactor: remove dead drain functions 2026-02-22 19:51:35 +01:00
db0cced754
fix: use correct destination pid when starting backends 2026-02-22 19:51:35 +01:00
8116066816
refactor: direct send from kqueue background thread 2026-02-22 19:51:35 +01:00
7da00d6a64
refactor: add an FSEvents based backend for macos 2026-02-22 19:51:35 +01:00