From 8b644e74fa4bf21902b47a0df28c8537e980b3b4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Jul 2013 15:32:24 -0400 Subject: [PATCH] catch does not exist error when adding a watch This could be thrown due to eg, the directory being moved or deleted, so the error should not be propigated. --- Utility/INotify.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Utility/INotify.hs b/Utility/INotify.hs index 2ce2b36aa3..e9071d906f 100644 --- a/Utility/INotify.hs +++ b/Utility/INotify.hs @@ -144,13 +144,15 @@ watchDir i dir ignored hooks _ -> noop filetype t f = catchBoolIO $ t <$> getSymbolicLinkStatus (indir f) - -- Inotify fails when there are too many watches with a - -- disk full error. failedaddwatch e + -- Inotify fails when there are too many watches with a + -- disk full error. | isFullError e = case errHook hooks of Nothing -> throw e Just hook -> tooManyWatches hook dir + -- The directory could have been deleted. + | isDoesNotExistError e = return () | otherwise = throw e tooManyWatches :: (String -> Maybe FileStatus -> IO ()) -> FilePath -> IO ()