avoid hanging on exception

This commit is contained in:
Joey Hess 2020-07-13 12:36:15 -04:00
parent bff5694f55
commit 918b1faa3d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 20 additions and 6 deletions

View file

@ -267,19 +267,21 @@ seekFiltered a fs = do
-- This is significantly faster than using lookupKey after seekFiltered.
seekFilteredKeys :: (RawFilePath -> Key -> CommandSeek) -> Annex [(RawFilePath, Git.Sha, FileMode)] -> Annex ()
seekFilteredKeys a fs = do
seekFilteredKeys a listfs = do
g <- Annex.gitRepo
matcher <- Limit.getMatcher
-- Run here, not in the async, because it could throw an exception
-- The list should be built lazily.
l <- listfs
catObjectStream g $ \feeder closer reader -> do
processertid <- liftIO . async =<< forkState
(gofeed matcher feeder closer)
(gofeed l matcher feeder closer)
goread reader
join (liftIO (wait processertid))
where
gofeed matcher feeder closer = do
l <- fs
forM_ l $ process matcher feeder
liftIO closer
gofeed l matcher feeder closer =
forM_ l (process matcher feeder)
`finally` liftIO closer
goread reader = liftIO reader >>= \case
Just (f, content) -> do