From 4eb2a663e4d4ff00d121c5f595f2eb7248b98199 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Jul 2017 13:23:33 -0400 Subject: Revert "speed up chain output displaying" This reverts commit c59ce983999ddbfe6cb8b27e4f376b5c37d7f853. That was wrong because only the *last* line of chain output is a Result. It could be that a previous line is able to be read as a Result, and the commit would make processing bail out at that point. --- src/Propellor/Message.hs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/Propellor') diff --git a/src/Propellor/Message.hs b/src/Propellor/Message.hs index 1551eb7d..c56f0c5a 100644 --- a/src/Propellor/Message.hs +++ b/src/Propellor/Message.hs @@ -27,12 +27,10 @@ import System.IO.Unsafe (unsafePerformIO) import Control.Concurrent import System.Console.Concurrent import Control.Applicative -import Control.Monad import Prelude import Propellor.Types import Propellor.Types.Exception -import Propellor.Debug import Utility.PartialPrelude import Utility.Monad import Utility.Exception @@ -149,20 +147,21 @@ colorLine intensity color msg = concat <$> sequence processChainOutput :: Handle -> IO Result processChainOutput h = go Nothing where - go rval = do + go lastline = do v <- catchMaybeIO (hGetLine h) case v of - Nothing -> case rval of - Nothing -> return FailedChange - Just r -> return r - Just s -> do - case readish s of + Nothing -> case lastline of + Nothing -> do + return FailedChange + Just l -> case readish l of + Just r -> pure r Nothing -> do - unless (null s) $ do - debug ["chain process output", show v] - outputConcurrent (s ++ "\n") - go rval - Just rval' -> go rval' + outputConcurrent (l ++ "\n") + return FailedChange + Just s -> do + outputConcurrent $ + maybe "" (\l -> if null l then "" else l ++ "\n") lastline + go (Just s) -- | Called when all messages about properties have been printed. messagesDone :: IO () -- cgit v1.2.3