fix: log silent errors and fix scan_dir dangling snapshot key

This commit is contained in:
CJ van den Berg 2026-03-15 00:08:07 +01:00
parent 046c304c60
commit eb42d23fc8
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
5 changed files with 43 additions and 14 deletions

View file

@ -220,6 +220,11 @@ fn callback(
// a single event. Emit one change call per applicable flag so
// callers see all relevant event types (e.g. created + modified).
const ot: ObjectType = if (flags & kFSEventStreamEventFlagItemIsDir != 0) .dir else .file;
// Handler errors are silently ignored: this callback runs on a GCD
// dispatch thread managed by the OS, so there is no way to propagate
// an error back to the caller. Stopping the stream from inside the
// callback would require a separate signal channel and is not worth
// the complexity; the stream will keep delivering future events.
if (flags & kFSEventStreamEventFlagItemCreated != 0) {
ctx.handler.change(path, .created, ot) catch {};
}