Skip to content

Commit

Permalink
Merge pull request #4679 from commercialhaskell/2997-warnings-with-color
Browse files Browse the repository at this point in the history
Warnings are dumped with color output (fixes #2997)
  • Loading branch information
snoyberg committed Apr 1, 2019
2 parents e9eafcc + 2dc354f commit 6d18b15
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ Bug fixes:
[#4598](https://github.com/commercialhaskell/stack/issues/4598)
* Hackage credentials are not world-readable. See
[#2159](https://github.com/commercialhaskell/stack/issues/2159).
* Warnings are dumped from logs even when color is enabled. See
[#2997](https://github.com/commercialhaskell/stack/issues/2997)

## v1.9.3

Expand Down
1 change: 1 addition & 0 deletions src/Stack/Build/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ withExecuteEnv bopts boptsCli baseConfigOpts locals globalPackages snapshotPacka
isWarning :: Text -> Bool
isWarning t = ": Warning:" `T.isSuffixOf` t -- prior to GHC 8
|| ": warning:" `T.isInfixOf` t -- GHC 8 is slightly different
|| "mwarning:" `T.isInfixOf` t -- colorized output

dumpLog :: String -> (Path Abs Dir, Path Abs File) -> RIO env ()
dumpLog msgSuffix (pkgDir, filepath) = do
Expand Down
10 changes: 10 additions & 0 deletions test/integration/tests/2997-ensure-warnings-output/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import StackTest
import Data.List (isInfixOf)

main :: IO ()
main = do
stack ["clean", "--full"]
stackCheckStderr ["build", "--terminal", "--color=always"] $ \str ->
if "no type signature" `isInfixOf` str
then pure ()
else error "Warnings are not being shown"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: bar
version: 0

dependencies:
- base

library:
source-dirs: src
ghc-options: -Wall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Bar where

bar = ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: foo
version: 0

dependencies:
- base

library:
source-dirs: src
ghc-options: -Wall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Foo where

foo = ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resolver: ghc-8.2.2
packages:
- foo
- bar
dump-logs: warning

0 comments on commit 6d18b15

Please sign in to comment.