summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-05 12:28:50 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-05 12:28:50 -0400
commit5a884ef6efe4ab8b572d6397148b9061b80cc75d (patch)
tree3c34b863fe4876f16acdf730cc5e20a6897a4fcf /Assistant
parent080ac5531e91a172f5229ee8a58a839d3d6e0be6 (diff)
avoid crashing threads that drop content if the drop crashes
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Drop.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Assistant/Drop.hs b/Assistant/Drop.hs
index 15bda77c2..6ea180d99 100644
--- a/Assistant/Drop.hs
+++ b/Assistant/Drop.hs
@@ -16,6 +16,7 @@ import qualified Remote
import qualified Command.Drop
import Command
import Annex.Wanted
+import Annex.Exception
import Config
{- Drop from local and/or remote when allowed by the preferred content and
@@ -52,7 +53,7 @@ handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
| otherwise = noop
checkdrop n@(_, numcopies) u a = ifM (wantDrop u (Just f))
- ( ifM (doCommand $ a (Just numcopies))
+ ( ifM (safely $ doCommand $ a (Just numcopies))
( return $ decrcopies n
, return n
)
@@ -64,3 +65,5 @@ handleDropsFrom locs rs fromhere key (Just f) knownpresentremote
dropr r n = checkdrop n (Just $ Remote.uuid r) $ \numcopies ->
Command.Drop.startRemote f numcopies key r
+
+ safely a = either (const False) id <$> tryAnnex a