audit all uses of SomeException to avoid catching async exceptions
Except for the assistant, which I think may use them between threads? Most of the uses of SomeException were already catching only async exceptions. But I did find a few places that were accidentially catching them.
This commit is contained in:
parent
dca19099a9
commit
319f2a4afc
4 changed files with 4 additions and 7 deletions
|
@ -18,7 +18,6 @@ module Annex.Ingest (
|
||||||
addLink,
|
addLink,
|
||||||
makeLink,
|
makeLink,
|
||||||
addUnlocked,
|
addUnlocked,
|
||||||
restoreFile,
|
|
||||||
forceParams,
|
forceParams,
|
||||||
addAnnexedFile,
|
addAnnexedFile,
|
||||||
) where
|
) where
|
||||||
|
|
|
@ -14,7 +14,6 @@ module CmdLine (
|
||||||
|
|
||||||
import qualified Options.Applicative as O
|
import qualified Options.Applicative as O
|
||||||
import qualified Options.Applicative.Help as H
|
import qualified Options.Applicative.Help as H
|
||||||
import qualified Control.Exception as E
|
|
||||||
import Control.Exception (throw)
|
import Control.Exception (throw)
|
||||||
|
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
|
@ -31,7 +30,7 @@ import Types.Messages
|
||||||
dispatch :: Bool -> CmdParams -> [Command] -> [GlobalOption] -> [(String, String)] -> IO Git.Repo -> String -> String -> IO ()
|
dispatch :: Bool -> CmdParams -> [Command] -> [GlobalOption] -> [(String, String)] -> IO Git.Repo -> String -> String -> IO ()
|
||||||
dispatch fuzzyok allargs allcmds globaloptions fields getgitrepo progname progdesc = do
|
dispatch fuzzyok allargs allcmds globaloptions fields getgitrepo progname progdesc = do
|
||||||
setupConsole
|
setupConsole
|
||||||
go =<< (E.try getgitrepo :: IO (Either E.SomeException Git.Repo))
|
go =<< tryNonAsync getgitrepo
|
||||||
where
|
where
|
||||||
go (Right g) = do
|
go (Right g) = do
|
||||||
state <- Annex.new g
|
state <- Annex.new g
|
||||||
|
|
|
@ -208,7 +208,7 @@ coreBare = "core.bare"
|
||||||
- and returns a repo populated with the configuration, as well as the raw
|
- and returns a repo populated with the configuration, as well as the raw
|
||||||
- output and any standard output of the command. -}
|
- output and any standard output of the command. -}
|
||||||
fromPipe :: Repo -> String -> [CommandParam] -> ConfigStyle -> IO (Either SomeException (Repo, S.ByteString, S.ByteString))
|
fromPipe :: Repo -> String -> [CommandParam] -> ConfigStyle -> IO (Either SomeException (Repo, S.ByteString, S.ByteString))
|
||||||
fromPipe r cmd params st = try $ withCreateProcess p go
|
fromPipe r cmd params st = tryNonAsync $ withCreateProcess p go
|
||||||
where
|
where
|
||||||
p = (proc cmd $ toCommand params)
|
p = (proc cmd $ toCommand params)
|
||||||
{ std_out = CreatePipe
|
{ std_out = CreatePipe
|
||||||
|
|
|
@ -12,7 +12,6 @@ import Remote.Helper.Chunked
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
|
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
import qualified Control.Exception as E
|
|
||||||
|
|
||||||
{- This is an extension that's added to the usual file (or whatever)
|
{- This is an extension that's added to the usual file (or whatever)
|
||||||
- where the remote stores a key. -}
|
- where the remote stores a key. -}
|
||||||
|
@ -87,8 +86,8 @@ storeChunks key tmp dest storer recorder finalizer = do
|
||||||
- writes a whole L.ByteString at a time.
|
- writes a whole L.ByteString at a time.
|
||||||
-}
|
-}
|
||||||
storeChunked :: ChunkSize -> [FilePath] -> (FilePath -> L.ByteString -> IO ()) -> L.ByteString -> IO [FilePath]
|
storeChunked :: ChunkSize -> [FilePath] -> (FilePath -> L.ByteString -> IO ()) -> L.ByteString -> IO [FilePath]
|
||||||
storeChunked chunksize dests storer content = either onerr return
|
storeChunked chunksize dests storer content =
|
||||||
=<< (E.try (go (Just chunksize) dests) :: IO (Either E.SomeException [FilePath]))
|
either onerr return =<< tryNonAsync (go (Just chunksize) dests)
|
||||||
where
|
where
|
||||||
go _ [] = return [] -- no dests!?
|
go _ [] = return [] -- no dests!?
|
||||||
go Nothing (d:_) = do
|
go Nothing (d:_) = do
|
||||||
|
|
Loading…
Reference in a new issue