summaryrefslogtreecommitdiff
path: root/Utility/MagicWormhole.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-27 16:26:26 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-27 16:26:26 -0400
commit60aca47a1a87e50a779a39115c142c5acbc0207d (patch)
tree333c902000a156bfd934334060c394f0f5cffeb2 /Utility/MagicWormhole.hs
parentfc5323ce2b17e86feefec668edc811d4ecbab726 (diff)
avoid leaving MVar empty
Something might want to observe the code multiple times.
Diffstat (limited to 'Utility/MagicWormhole.hs')
-rw-r--r--Utility/MagicWormhole.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Utility/MagicWormhole.hs b/Utility/MagicWormhole.hs
index e217dcdca..3743f352c 100644
--- a/Utility/MagicWormhole.hs
+++ b/Utility/MagicWormhole.hs
@@ -78,7 +78,7 @@ mkCodeProducer :: IO CodeProducer
mkCodeProducer = CodeProducer <$> newEmptyMVar
waitCode :: CodeObserver -> IO Code
-waitCode (CodeObserver o) = takeMVar o
+waitCode (CodeObserver o) = readMVar o
sendCode :: CodeProducer -> Code -> IO ()
sendCode (CodeProducer p) = putMVar p
@@ -119,7 +119,7 @@ sendFile f (CodeObserver observer) ps = do
-- read from the CodeProducer, and fed to wormhole on stdin.
receiveFile :: FilePath -> CodeProducer -> WormHoleParams -> IO Bool
receiveFile f (CodeProducer producer) ps = runWormHoleProcess p $ \hin _hout -> do
- Code c <- takeMVar producer
+ Code c <- readMVar producer
hPutStrLn hin c
hFlush hin
return True