chore: notify -> 5.0.0-pre.11

This commit is contained in:
eric committed 2021-08-06 06:06:21 +08:00
1 parent 9d201ff6e0
commit cfaf9736f4
2 files changed
+6 -3

No files matched your search

+1 -1
View File
@@ -207,7 +207,7 @@ rustls = { version = "0.19", optional = true }
warp = { version = "0.3", default-features = false, optional = true }
# Auto reload
notify = { version = "5.0.0-pre.6", optional = true }
notify = { version = "5.0.0-pre.11", optional = true }
# TUN
[target.'cfg(any(target_os = "ios", target_os = "android", target_os = "macos", target_os = "linux"))'.dependencies]
+5 -2
View File
@@ -189,7 +189,7 @@ impl RuntimeManager {
log::trace!("starting new watcher for config file: {}", config_path);
let rt_id = self.rt_id;
let mut watcher: RecommendedWatcher =
Watcher::new_immediate(move |res: NotifyResult<event::Event>| {
notify::recommended_watcher(move |res: NotifyResult<event::Event>| {
match res {
// FIXME Not sure what are the most appropriate events to
// filter on different platforms.
@@ -245,7 +245,10 @@ impl RuntimeManager {
})
.map_err(Error::Watcher)?;
watcher
.watch(config_path, RecursiveMode::NonRecursive)
.watch(
std::path::Path::new(&config_path),
RecursiveMode::NonRecursive,
)
.map_err(Error::Watcher)?;
log::info!("watching changes of file: {}", config_path);
self.watcher.lock().unwrap().replace(watcher);