aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-07-17 15:32:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-07-17 15:32:24 -0400
commit1a90265f6e2700a1af971c2e28b6408fcc58def6 (patch)
tree2aef3e24b6a44a991532dd0a6b510cf24051e546
parent8c0a6283791b6c06a95c1b0642523c0701c8a13f (diff)
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.
-rw-r--r--Utility/INotify.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Utility/INotify.hs b/Utility/INotify.hs
index 2ce2b36aa..e9071d906 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 ()