summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-16 13:40:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-16 13:40:44 -0400
commit89776ff6d7849f786db35de610b88aa9556f1623 (patch)
tree88f8a2bf19d8e76df8e5d3ad76774cc704ee4ae2 /Utility
parentf90839eada85dbccc29ee171d1b36020af342792 (diff)
Windows: Avoid crashing trying to list gpg secret keys, for gcrypt which is not yet supported on Windows.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Gpg.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs
index 69a47c78f..f9b60f276 100644
--- a/Utility/Gpg.hs
+++ b/Utility/Gpg.hs
@@ -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) =