summaryrefslogtreecommitdiff
path: root/Assistant/Watcher.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Watcher.hs')
-rw-r--r--Assistant/Watcher.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Assistant/Watcher.hs b/Assistant/Watcher.hs
index 1d35b5c1e..7c913d98c 100644
--- a/Assistant/Watcher.hs
+++ b/Assistant/Watcher.hs
@@ -33,12 +33,15 @@ import qualified Data.ByteString.Lazy as L
import Utility.Inotify
import System.INotify
#endif
+#ifdef WITH_KQUEUE
+import Utility.Kqueue
+#endif
type Handler = FilePath -> Maybe FileStatus -> DaemonStatusHandle -> Annex (Maybe Change)
checkCanWatch :: Annex ()
checkCanWatch = do
-#ifdef WITH_INOTIFY
+#if (WITH_INOTIFY || WITH_KQUEUE)
unlessM (liftIO (inPath "lsof") <||> Annex.getState Annex.force) $
needLsof
#else
@@ -82,8 +85,13 @@ watchThread st dstatus changechan = withINotify $ \i -> do
, errHook = hook onErr
}
#else
+#ifdef WITH_KQUEUE
+watchThread st dstatus changechan = do
+ print =<< waitChange [stdError, stdOutput]
+#else
watchThread = undefined
-#endif
+#endif /* WITH_KQUEUE */
+#endif /* WITH_INOTIFY */
ignored :: FilePath -> Bool
ignored ".git" = True