diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-05 12:28:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-05 12:28:50 -0400 |
commit | 5a884ef6efe4ab8b572d6397148b9061b80cc75d (patch) | |
tree | 3c34b863fe4876f16acdf730cc5e20a6897a4fcf /Assistant | |
parent | 080ac5531e91a172f5229ee8a58a839d3d6e0be6 (diff) |
avoid crashing threads that drop content if the drop crashes
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Drop.hs | 5 |
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 |