From 84ee05baa64fc544423741788aedc2a0e769840e Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 10 Nov 2020 07:00:13 -0800 Subject: [PATCH] Shake cabalfiles: give an error when this fails --- Shake.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Shake.hs b/Shake.hs index f30da7ab7..ac1865772 100755 --- a/Shake.hs +++ b/Shake.hs @@ -503,7 +503,12 @@ main = do -- regenerate .cabal files from package.yaml's, using stack (also installs deps) phony "cabalfiles" $ do - cmd Shell "stack build --dry-run --silent" :: Action () + -- can fail to update cabal files, with zero exit status; need + -- to check stderr, and only for error message since all + -- output goes there + err <- fromStderr <$> (cmd Shell "stack build --dry-run" :: Action (Stderr String)) + when ("was generated with a newer version of hpack" `isInfixOf` err) $ + liftIO $ putStr err >> exitFailure when commit $ do let msg = ";update cabal files" cmd Shell gitcommit ("-m '"++msg++"' --") cabalfiles