Windows: Avoid crashing trying to list gpg secret keys, for gcrypt which is not yet supported on Windows.

This commit is contained in:
Joey Hess 2014-09-16 13:40:44 -04:00
parent ebd781984e
commit 2abeae7582
3 changed files with 14 additions and 1 deletions

View file

@ -163,8 +163,9 @@ type UserId = String
{- All of the user's secret keys, with their UserIds.
- Note that the UserId may be empty. -}
secretKeys :: IO (M.Map KeyId UserId)
secretKeys = M.fromList . parse . lines <$> readStrict params
secretKeys = catchDefaultIO M.empty makemap
where
makemap = M.fromList . parse . lines <$> readStrict params
params = [Params "--with-colons --list-secret-keys --fixed-list-mode"]
parse = extract [] Nothing . map (split ":")
extract c (Just keyid) (("uid":_:_:_:_:_:_:_:_:userid:_):rest) =