mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-14 00:01:12 +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 notify::Watcher as _;
|
||||||
use tokio::sync::{mpsc, watch};
|
use tokio::sync::{mpsc, watch};
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, error, trace};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::{CriticalError, RuntimeError},
|
error::{CriticalError, RuntimeError},
|
||||||
|
@ -157,6 +157,7 @@ pub async fn worker(
|
||||||
for path in to_drop {
|
for path in to_drop {
|
||||||
trace!(?path, "removing path from the watcher");
|
trace!(?path, "removing path from the watcher");
|
||||||
if let Err(err) = w.unwatch(&path) {
|
if let Err(err) = w.unwatch(&path) {
|
||||||
|
error!(?err, "notify unwatch() error");
|
||||||
errors
|
errors
|
||||||
.send(RuntimeError::FsWatcherPathRemove {
|
.send(RuntimeError::FsWatcherPathRemove {
|
||||||
path,
|
path,
|
||||||
|
@ -172,6 +173,7 @@ pub async fn worker(
|
||||||
for path in to_watch {
|
for path in to_watch {
|
||||||
trace!(?path, "adding path to the watcher");
|
trace!(?path, "adding path to the watcher");
|
||||||
if let Err(err) = w.watch(&path, notify::RecursiveMode::Recursive) {
|
if let Err(err) = w.watch(&path, notify::RecursiveMode::Recursive) {
|
||||||
|
error!(?err, "notify watch() error");
|
||||||
errors
|
errors
|
||||||
.send(RuntimeError::FsWatcherPathAdd {
|
.send(RuntimeError::FsWatcherPathAdd {
|
||||||
path,
|
path,
|
||||||
|
@ -179,6 +181,7 @@ pub async fn worker(
|
||||||
err,
|
err,
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
// TODO: unwatch and re-watch manually while ignoring all the erroring paths
|
||||||
} else {
|
} else {
|
||||||
pathset.insert(path);
|
pathset.insert(path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue