Skip to content

Fix --watch crash on new fsnotify events - #680

Merged
srid merged 2 commits into
masterfrom
fix-watch-crash-679
Sep 28, 2026
Merged

srid merged 2 commits into
masterfrom
fix-watch-crash-679

Conversation

@srid

@srid srid commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Fixes #679.

The GHC 9.10 upgrade (#677) pulled in fsnotify 0.4.4.0, which added new event constructors (CloseWrite, ModifiedAttributes, WatchedDirectoryRemoved). mkEventPathRelative in Neuron.Reactor only matched the four older ones, so neuron gen --watch crashed with Non-exhaustive patterns in \case on the first file save (Linux emits CloseWrite).

The fix rewrites the path using a record update on eventPath, which covers every constructor, including any future ones.

Tested: reproduced the crash with the pre-fix build, then with this build ran gen --watch and edited a note, added a PNG in a subfolder, created a note and deleted it. Each change rebuilt correctly with no crash.

fsnotify 0.4 added CloseWrite, ModifiedAttributes and
WatchedDirectoryRemoved, which mkEventPathRelative did not match,
crashing on the first file save. Use a record update on eventPath so
all constructors are handled.
@srid
srid merged commit 070a9e1 into master Sep 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--watch flag makes neuron crash due to non-exaustive matching by Reactor.hs

1 participant