show last line if it cannot be parsed as a serialized Result
This commit is contained in:
parent
40bfcacf4e
commit
0a415a7b41
|
@ -11,7 +11,6 @@ import "mtl" Control.Monad.Reader
|
||||||
import Control.Exception (bracket)
|
import Control.Exception (bracket)
|
||||||
import System.PosixCompat
|
import System.PosixCompat
|
||||||
import System.Posix.IO
|
import System.Posix.IO
|
||||||
import Data.Maybe
|
|
||||||
|
|
||||||
import Propellor.Types
|
import Propellor.Types
|
||||||
import Propellor.Message
|
import Propellor.Message
|
||||||
|
@ -74,8 +73,14 @@ processChainOutput h = go Nothing
|
||||||
go lastline = do
|
go lastline = do
|
||||||
v <- catchMaybeIO (hGetLine h)
|
v <- catchMaybeIO (hGetLine h)
|
||||||
case v of
|
case v of
|
||||||
Nothing -> pure $ fromMaybe FailedChange $
|
Nothing -> case lastline of
|
||||||
readish =<< lastline
|
Nothing -> pure FailedChange
|
||||||
|
Just l -> case readish l of
|
||||||
|
Just r -> pure r
|
||||||
|
Nothing -> do
|
||||||
|
putStrLn l
|
||||||
|
hFlush stdout
|
||||||
|
return FailedChange
|
||||||
Just s -> do
|
Just s -> do
|
||||||
maybe noop (\l -> unless (null l) (putStrLn l)) lastline
|
maybe noop (\l -> unless (null l) (putStrLn l)) lastline
|
||||||
hFlush stdout
|
hFlush stdout
|
||||||
|
|
Loading…
Reference in New Issue