diff options
author | Joey Hess <joey@kitenet.net> | 2013-09-24 17:51:12 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-09-24 17:51:12 -0400 |
commit | 2270913743982ab33c68d17c8ed68326e1711f95 (patch) | |
tree | dbc8b7ad18e705345cb27daf051e8ff131a5031e /Git/Config.hs | |
parent | e079835fdd71231f680b86fac4f283d8d1afa2e0 (diff) |
add back lost check that git-annex-shell supports gcrypt
Diffstat (limited to 'Git/Config.hs')
-rw-r--r-- | Git/Config.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Git/Config.hs b/Git/Config.hs index adc75a208..513c3e5a6 100644 --- a/Git/Config.hs +++ b/Git/Config.hs @@ -10,6 +10,7 @@ module Git.Config where import qualified Data.Map as M import Data.Char import System.Process (cwd, env) +import Control.Exception.Extensible import Common import Git @@ -153,3 +154,17 @@ boolConfig False = "false" isBare :: Repo -> Bool isBare r = fromMaybe False $ isTrue =<< getMaybe "core.bare" r + +{- Runs a command to get the configuration of a repo, + - and returns a repo populated with the configuration, as well as the raw + - output of the command. -} +fromPipe :: Repo -> String -> [CommandParam] -> IO (Either SomeException (Repo, String)) +fromPipe r cmd params = try $ + withHandle StdoutHandle createProcessSuccess p $ \h -> do + fileEncoding h + val <- hGetContentsStrict h + r' <- store val r + return (r', val) + where + p = proc cmd $ toCommand params + |