aboutsummaryrefslogtreecommitdiff
path: root/Utility/Gpg.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-16 15:27:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-16 15:27:46 -0400
commit643bb4a3e1494e35f276c5aa789ebecb2127f79f (patch)
treef8697dcb0fc4e4418d37bdb5f206f4660d8a98d5 /Utility/Gpg.hs
parentff469c1d5e41764651869e8dc2f0322257811a7a (diff)
Deal with incompatability in gpg2, which caused prompts for encryption passphrases rather than using the supplied --passphrase-fd.
Diffstat (limited to 'Utility/Gpg.hs')
-rw-r--r--Utility/Gpg.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs
index ca017ed3a..0c80ecdf3 100644
--- a/Utility/Gpg.hs
+++ b/Utility/Gpg.hs
@@ -58,6 +58,9 @@ pipeStrict params input = do
- should write to it all the data to input to gpg. Finally, runs
- a reader action that is passed a handle to gpg's output.
-
+ - Runs gpg in batch mode; this is necessary to avoid gpg 2.x prompting for
+ - the passphrase.
+ -
- Note that to avoid deadlock with the cleanup stage,
- the reader must fully consume gpg's input before returning. -}
feedRead :: [CommandParam] -> String -> (Handle -> IO ()) -> (Handle -> IO a) -> IO a
@@ -71,7 +74,7 @@ feedRead params passphrase feeder reader = do
let Fd pfd = frompipe
let passphrasefd = [Param "--passphrase-fd", Param $ show pfd]
- params' <- stdParams $ passphrasefd ++ params
+ params' <- stdParams $ [Param "--batch"] ++ passphrasefd ++ params
closeFd frompipe `after`
withBothHandles createProcessSuccess (proc "gpg" params') go
where