stop cleanly when there's a IO error accessing the Handle

All other exceptions are let through, but IO errors accessing the handle
are to be expected, so quietly ignore.
This commit is contained in:
Joey Hess 2016-11-21 21:22:58 -04:00
parent ae69ebfc7c
commit 483dbcdbef
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
3 changed files with 70 additions and 60 deletions

View file

@ -32,7 +32,8 @@ run (_remotename:address:[]) = forever $ do
| otherwise = parseAddressPort address
go service = do
ready
connectService onionaddress onionport service >>= exitWith
res <- connectService onionaddress onionport service
exitWith (fromMaybe (ExitFailure 1) res)
ready = do
putStrLn ""
hFlush stdout
@ -47,7 +48,7 @@ parseAddressPort s =
Nothing -> giveup "onion address must include port number"
Just p -> (OnionAddress a, p)
connectService :: OnionAddress -> OnionPort -> Service -> IO ExitCode
connectService :: OnionAddress -> OnionPort -> Service -> IO (Maybe ExitCode)
connectService address port service = do
state <- Annex.new =<< Git.CurrentRepo.get
Annex.eval state $ do