summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-01-16 05:52:41 -0500
committerBen Sima <ben@bsima.me>2021-01-16 05:56:20 -0500
commitebea9b0005b983935f7bc159bb738ace874591f8 (patch)
treef05b8c1dad1a80f94439c096f63c359083642a51
parent79fc1bd6a51a97b905b1f15c6b74c0a8062aaa89 (diff)
Check and print bild --test output
-rw-r--r--Biz/Bild.hs13
1 files changed, 10 insertions, 3 deletions
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] <target>...
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