From c5d51c1e89548d693e8e10b514e83e9b472ec2a6 Mon Sep 17 00:00:00 2001 From: darcy Date: Tue, 17 Sep 2024 16:39:31 +1000 Subject: [PATCH] Check if watched file was recreated after remove --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index a853bc5..0127871 100644 --- a/src/main.rs +++ b/src/main.rs @@ -133,8 +133,12 @@ fn main() -> miette::Result<()> { Flow::Continue } EventKind::Remove(_) => { - message(Red, "Error", "watched file was deleted. Exiting..."); - std::process::exit(1); + if name.exists() { + Flow::Continue + } else { + message(Red, "Error", "watched file was deleted. Exiting..."); + std::process::exit(1); + } } _ => Flow::Continue, })