Fix overbroad gpg --no-tty fix from last release.

Only set --no-tty when GPG_AGENT_INFO is set and batch mode is used.

In the test suite, set GPG_AGENT_INFO to /dev/null to avoid the test suite
relying on /dev/tty.
This commit is contained in:
Joey Hess 2012-01-07 12:38:08 -04:00
parent bdc49ddbdb
commit 60c1aeeb6f
3 changed files with 6 additions and 4 deletions

View file

@ -25,12 +25,11 @@ stdParams params = do
-- Enable batch mode if GPG_AGENT_INFO is set, to avoid extraneous
-- gpg output about password prompts.
e <- getEnv "GPG_AGENT_INFO"
let batch = if isNothing e then [] else ["--batch"]
let batch = if isNothing e then [] else ["--batch", "--no-tty"]
return $ batch ++ defaults ++ toCommand params
where
-- be quiet, even about checking the trustdb,
-- and avoid using a tty
defaults = ["--quiet", "--trust-model", "always", "--no-tty"]
-- be quiet, even about checking the trustdb
defaults = ["--quiet", "--trust-model", "always"]
{- Runs gpg with some params and returns its stdout, strictly. -}
readStrict :: [CommandParam] -> IO String