add comments explaining puzzling code
This commit is contained in:
parent
ed81762c86
commit
7d83502329
1 changed files with 4 additions and 0 deletions
|
@ -71,9 +71,13 @@ processTranscript'' cp input = do
|
||||||
return (transcript, code)
|
return (transcript, code)
|
||||||
where
|
where
|
||||||
mkreader h = do
|
mkreader h = do
|
||||||
|
-- Start consuming the output immediately, because the
|
||||||
|
-- process may block on reading input until some
|
||||||
|
-- of its output is consumed.
|
||||||
s <- hGetContents h
|
s <- hGetContents h
|
||||||
v <- newEmptyMVar
|
v <- newEmptyMVar
|
||||||
void $ forkIO $ do
|
void $ forkIO $ do
|
||||||
|
-- Wait for output to be fully consumed.
|
||||||
void $ E.evaluate (length s)
|
void $ E.evaluate (length s)
|
||||||
putMVar v ()
|
putMVar v ()
|
||||||
return $ do
|
return $ do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue