simpler exception handling
This commit is contained in:
parent
f516b820ca
commit
8f99409518
1 changed files with 2 additions and 2 deletions
|
@ -16,8 +16,8 @@ import System.Directory
|
||||||
import System.Path
|
import System.Path
|
||||||
import System.Cmd.Utils
|
import System.Cmd.Utils
|
||||||
import System.IO
|
import System.IO
|
||||||
|
import System.IO.Error
|
||||||
import Data.String.Utils
|
import Data.String.Utils
|
||||||
import Control.Exception
|
|
||||||
import Utility
|
import Utility
|
||||||
|
|
||||||
-- a git repository
|
-- a git repository
|
||||||
|
@ -79,7 +79,7 @@ gitAdd repo file = do
|
||||||
{- Queries git-config. -}
|
{- Queries git-config. -}
|
||||||
gitConfigGet :: String -> String -> IO String
|
gitConfigGet :: String -> String -> IO String
|
||||||
gitConfigGet name defaultValue =
|
gitConfigGet name defaultValue =
|
||||||
handle ((\_ -> return defaultValue)::SomeException -> IO String) $
|
flip catch (\_ -> return defaultValue) $
|
||||||
pOpen ReadFromPipe "git" ["config", "--get", name] $ \h -> do
|
pOpen ReadFromPipe "git" ["config", "--get", name] $ \h -> do
|
||||||
ret <- hGetLine h
|
ret <- hGetLine h
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue