aboutsummaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-09 16:27:20 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-09 16:40:47 -0400
commit5a919f01d178b8d6c0bb3b0b40d8c7fea7ff7ac6 (patch)
tree3b5da82b53b9550c1c6f637aae981d2252accc0c /Annex
parent3d6a48572d1b626ef68785d3e7ed400b4016d9e5 (diff)
make tor hidden service work when directory watching is not available
Avoid crashing when built w/o inotify..
Diffstat (limited to 'Annex')
-rw-r--r--Annex/ChangedRefs.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Annex/ChangedRefs.hs b/Annex/ChangedRefs.hs
index 0dc82d3b3..1f2372c04 100644
--- a/Annex/ChangedRefs.hs
+++ b/Annex/ChangedRefs.hs
@@ -71,7 +71,7 @@ stopWatchingChangedRefs h@(ChangedRefsHandle wh chan) = do
atomically $ closeTBMChan chan
drainChangedRefs h
-watchChangedRefs :: Annex ChangedRefsHandle
+watchChangedRefs :: Annex (Maybe ChangedRefsHandle)
watchChangedRefs = do
-- This channel is used to accumulate notifications,
-- because the DirWatcher might have multiple threads that find
@@ -90,8 +90,11 @@ watchChangedRefs = do
, modifyHook = notifyhook
}
- h <- liftIO $ watchDir refdir (const False) True hooks id
- return $ ChangedRefsHandle h chan
+ if canWatch
+ then do
+ h <- liftIO $ watchDir refdir (const False) True hooks id
+ return $ Just $ ChangedRefsHandle h chan
+ else return Nothing
notifyHook :: TBMChan Git.Sha -> FilePath -> Maybe FileStatus -> IO ()
notifyHook chan reffile _