aboutsummaryrefslogtreecommitdiff
path: root/Utility/Process.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-12 02:54:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-12 02:54:19 -0400
commitef4d1f04322d9af0239222e13cd782d01c1e6d05 (patch)
tree265eb2fe11cc3cdd08a5009f49cf6d2097f88afb /Utility/Process.hs
parentd73a7c9926c9219a098454a4ccbe22aa7ffe04b6 (diff)
refactor
Diffstat (limited to 'Utility/Process.hs')
-rw-r--r--Utility/Process.hs11
1 files changed, 3 insertions, 8 deletions
diff --git a/Utility/Process.hs b/Utility/Process.hs
index fe8c6c479..398e8a352 100644
--- a/Utility/Process.hs
+++ b/Utility/Process.hs
@@ -177,10 +177,7 @@ processTranscript cmd opts input = do
}
hClose writeh
- -- fork off a thread to start consuming the output
- transcript <- hGetContents readh
- outMVar <- newEmptyMVar
- _ <- forkIO $ E.evaluate (length transcript) >> putMVar outMVar ()
+ get <- mkreader readh
-- now write and flush any input
case input of
@@ -192,9 +189,7 @@ processTranscript cmd opts input = do
hClose inh
Nothing -> return ()
- -- wait on the output
- takeMVar outMVar
- hClose readh
+ transcript <- get
ok <- checkSuccessProcess pid
return (transcript, ok)
@@ -223,6 +218,7 @@ processTranscript cmd opts input = do
transcript <- (++) <$> getout <*> geterr
ok <- checkSuccessProcess pid
return (transcript, ok)
+#endif
where
mkreader h = do
s <- hGetContents h
@@ -233,7 +229,6 @@ processTranscript cmd opts input = do
return $ do
takeMVar v
return s
-#endif
{- Runs a CreateProcessRunner, on a CreateProcess structure, that
- is adjusted to pipe only from/to a single StdHandle, and passes