fix gpg pipeline stall

Bug introduced in d1da9cf221, where
I removed a forkProcess when feeding gpg. Feeding it from a thread
solves the bug.
This commit is contained in:
Joey Hess 2012-09-09 13:11:54 -04:00
parent 4eb6a2966a
commit c6f3c410d4
2 changed files with 10 additions and 3 deletions

View file

@ -64,7 +64,7 @@ passphraseHandle :: [CommandParam] -> String -> IO L.ByteString -> (Handle -> IO
passphraseHandle params passphrase a b = do
-- pipe the passphrase into gpg on a fd
(frompipe, topipe) <- createPipe
_ <- forkIO $ do
void $ forkIO $ do
toh <- fdToHandle topipe
hPutStrLn toh passphrase
hClose toh
@ -76,8 +76,9 @@ passphraseHandle params passphrase a b = do
withBothHandles createProcessSuccess (proc "gpg" params') go
where
go (to, from) = do
L.hPut to =<< a
hClose to
void $ forkIO $ do
L.hPut to =<< a
hClose to
b from
{- Finds gpg public keys matching some string. (Could be an email address,