Closed pakanek closed 4 months ago
forkIO $ capture_ f
instead of capture_ $ forkIO f
? Note that the former captures the output of f
while it's running in a separate thread; the later only captures stdout
while the thread is started. Also note that the former is prone to race conditions as per (1).[^1]: Note that stdout
is a file descriptor and that capture_
captures stdout
.
That makes sense, thanks a lot. Should be something like
v <- newEmptyMVar
forkIO $ capture_ f >>= putMVar v
out1 <- readMVar v
Hello, is this expected output?