Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Upgrade to latest stable notify preview #1849

Merged
merged 10 commits into from
Apr 27, 2022
Merged

Conversation

ranweiler
Copy link
Member

@ranweiler ranweiler commented Apr 26, 2022

Update notify to its latest stable preview release 5.0.0-pre.14.

The latest notify release on crates.io is 4.0.17. The 4.x series receives very occasional backports (the last one was a year ago), but it is not actively developed, and a cargo audit run uncovers many issues that are unlikely to be addressed. This upgrade lets us avoid problematic transitive dependencies, and align our direct dependency on notify to its actively-maintained major version.

By upgrading to the most-stable 5.x preview version, we also get to use the new Watcher API. This accepts any implementer of the new EventHandler trait, which includes closures. This lets us directly send (fallible) watcher events via the synchronous UnboundedSender::send() method, instead of having to shim the sync Sender from the 4.x API with a background async task.

This PR also changes the DirectoryMonitor public API such that start() is async. This enables replacing a private use of the blocking std::fs::canonicalize() function. It also makes next_file() fallible, which reflects the fallibility of internal filesystem watch eventing. Finally, it adds unit tests and an example binary.

Closes #1083.

@ranweiler ranweiler requested a review from chkeita April 26, 2022 22:14
@ranweiler ranweiler merged commit 5d6f5f2 into microsoft:main Apr 27, 2022
@ranweiler ranweiler deleted the notify-5 branch April 27, 2022 22:00
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revisit use of notify when 5.0 is released
3 participants