mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-28 22:21:33 +02:00
Don't fail if we can't canonicalize an event path
e.g. for deletes
This commit is contained in:
parent
4737937350
commit
8bd48c6290
@ -11,7 +11,7 @@ use std::{
|
|||||||
|
|
||||||
use notify::Watcher as _;
|
use notify::Watcher as _;
|
||||||
use tokio::sync::{mpsc, watch};
|
use tokio::sync::{mpsc, watch};
|
||||||
use tracing::{debug, error, trace};
|
use tracing::{debug, error, trace, warn};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::{CriticalError, RuntimeError},
|
error::{CriticalError, RuntimeError},
|
||||||
@ -286,10 +286,10 @@ fn process_event(
|
|||||||
// possibly pull file_type from whatever notify (or the native driver) returns?
|
// possibly pull file_type from whatever notify (or the native driver) returns?
|
||||||
tags.push(Tag::Path {
|
tags.push(Tag::Path {
|
||||||
file_type: metadata(&path).ok().map(|m| m.file_type().into()),
|
file_type: metadata(&path).ok().map(|m| m.file_type().into()),
|
||||||
path: dunce::canonicalize(path).map_err(|err| RuntimeError::IoError {
|
path: dunce::canonicalize(&path).unwrap_or_else(|err| {
|
||||||
about: "canonicalise path in event",
|
warn!(?err, ?path, "failed to canonicalise event path");
|
||||||
err,
|
path
|
||||||
})?,
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user