IO exception rework
ghc 7.4 comaplains about use of System.IO.Error to catch exceptions. Ok, use Control.Exception, with variants specialized to only catch IO exceptions.
This commit is contained in:
parent
05f89123e0
commit
146c36ca54
14 changed files with 56 additions and 44 deletions
|
@ -25,7 +25,6 @@ module Annex.Content (
|
|||
preseedTmp,
|
||||
) where
|
||||
|
||||
import System.IO.Error (try)
|
||||
import Control.Exception (bracket_)
|
||||
import System.Posix.Types
|
||||
|
||||
|
@ -79,7 +78,7 @@ lockContent key a = do
|
|||
where
|
||||
lock Nothing = return Nothing
|
||||
lock (Just l) = do
|
||||
v <- try $ setLock l (WriteLock, AbsoluteSeek, 0, 0)
|
||||
v <- tryIO $ setLock l (WriteLock, AbsoluteSeek, 0, 0)
|
||||
case v of
|
||||
Left _ -> error "content is locked"
|
||||
Right _ -> return $ Just l
|
||||
|
|
|
@ -91,4 +91,4 @@ lockJournal a = do
|
|||
{- Runs an action, catching failure and running something to fix it up, and
|
||||
- retrying if necessary. -}
|
||||
doRedo :: IO a -> IO b -> IO a
|
||||
doRedo a b = catch a $ const $ b >> a
|
||||
doRedo a b = catchIO a $ const $ b >> a
|
||||
|
|
|
@ -11,7 +11,6 @@ module Annex.Ssh (
|
|||
) where
|
||||
|
||||
import qualified Data.Map as M
|
||||
import System.IO.Error (try)
|
||||
|
||||
import Common.Annex
|
||||
import Annex.LockPool
|
||||
|
@ -72,7 +71,8 @@ sshCleanup = do
|
|||
let lockfile = socket2lock socketfile
|
||||
unlockFile lockfile
|
||||
fd <- liftIO $ openFd lockfile ReadWrite (Just stdFileMode) defaultFileFlags
|
||||
v <- liftIO $ try $ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
|
||||
v <- liftIO $ tryIO $
|
||||
setLock fd (WriteLock, AbsoluteSeek, 0, 0)
|
||||
case v of
|
||||
Left _ -> return ()
|
||||
Right _ -> stopssh socketfile
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue