From d61e3866d794635de5875d7292861fb49ad0340a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 28 Oct 2015 15:47:23 -0400 Subject: fix buffer order Build it up reversed, and reverse when processing. --- src/Utility/ConcurrentOutput.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Utility') diff --git a/src/Utility/ConcurrentOutput.hs b/src/Utility/ConcurrentOutput.hs index 0f1cf9d3..5bf973de 100644 --- a/src/Utility/ConcurrentOutput.hs +++ b/src/Utility/ConcurrentOutput.hs @@ -248,7 +248,7 @@ outputDrainer ss fromh toh buf go _ -> atend atend = do - modifyMVar_ buf $ pure . (++ [(toh, ReachedEnd)]) + modifyMVar_ buf $ pure . ((toh, ReachedEnd) :) hClose fromh -- Wait to lock output, and once we can, display everything @@ -260,7 +260,7 @@ bufferWriter buf = lockOutput (go [stdout, stderr]) go [] = return () go hs = do l <- takeMVar buf - forM_ l $ \(h, ba) -> case ba of + forM_ (reverse l) $ \(h, ba) -> case ba of Output b -> do B.hPut h b hFlush h -- cgit v1.3-2-g0d8e