mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-13 07:41:11 +01:00
Log fs watch/unwatch errors harder (to reveal paths)
This commit is contained in:
parent
6cb3fc1c9a
commit
3588cb4d62
1 changed files with 4 additions and 1 deletions
|
@ -7,7 +7,7 @@ use std::{
|
|||
|
||||
use notify::Watcher as _;
|
||||
use tokio::sync::{mpsc, watch};
|
||||
use tracing::{debug, trace};
|
||||
use tracing::{debug, error, trace};
|
||||
|
||||
use crate::{
|
||||
error::{CriticalError, RuntimeError},
|
||||
|
@ -157,6 +157,7 @@ pub async fn worker(
|
|||
for path in to_drop {
|
||||
trace!(?path, "removing path from the watcher");
|
||||
if let Err(err) = w.unwatch(&path) {
|
||||
error!(?err, "notify unwatch() error");
|
||||
errors
|
||||
.send(RuntimeError::FsWatcherPathRemove {
|
||||
path,
|
||||
|
@ -172,6 +173,7 @@ pub async fn worker(
|
|||
for path in to_watch {
|
||||
trace!(?path, "adding path to the watcher");
|
||||
if let Err(err) = w.watch(&path, notify::RecursiveMode::Recursive) {
|
||||
error!(?err, "notify watch() error");
|
||||
errors
|
||||
.send(RuntimeError::FsWatcherPathAdd {
|
||||
path,
|
||||
|
@ -179,6 +181,7 @@ pub async fn worker(
|
|||
err,
|
||||
})
|
||||
.await?;
|
||||
// TODO: unwatch and re-watch manually while ignoring all the erroring paths
|
||||
} else {
|
||||
pathset.insert(path);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue