From ebea9b0005b983935f7bc159bb738ace874591f8 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 16 Jan 2021 05:52:41 -0500 Subject: Check and print bild --test output --- Biz/Bild.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Biz') diff --git a/Biz/Bild.hs b/Biz/Bild.hs index 9c341b9..ceb4856 100644 --- a/Biz/Bild.hs +++ b/Biz/Bild.hs @@ -131,6 +131,7 @@ import qualified Data.Text as Text import Rainbow (chunk, fore, green, putChunkLn, red) import qualified System.Directory as Dir import qualified System.Environment as Env +import qualified System.Exit as Exit import System.FilePath (()) import qualified System.Process as Process import qualified Text.Regex.Applicative as Regex @@ -153,6 +154,7 @@ help = bild Usage: + bild test bild [--test] ... Options: @@ -312,10 +314,15 @@ build andTest target@Target {..} = do "-o", outDir out ] - when andTest <| do - putStrLn <| "bild: dev: test: " <> Namespace.toPath namespace - Process.callProcess (outDir out) ["test"] putChunkLn <| fore green <| "bilt: " <> nschunk namespace + when andTest <| do + Process.readProcessWithExitCode (outDir out) ["test"] "" >>= \case + (Exit.ExitSuccess, _, _) -> + putChunkLn <| fore green <| "test: " <> nschunk namespace + (Exit.ExitFailure _, out, err) -> do + putChunkLn <| fore red <| "test: " <> nschunk namespace + when (out /= mempty) <| putStr out + when (err /= mempty) <| putStr err GhcLib -> do putStrLn <| "bild: dev: ghc-lib: " <> Namespace.toPath namespace putText <| "bild: dev: bilder: " <> Text.pack builder -- cgit v1.2.3