diff options
| author | hallgren <hallgren@chalmers.se> | 2014-10-28 19:04:48 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-10-28 19:04:48 +0000 |
| commit | 0519493ca936c8e555cfdf9178195418e342ff05 (patch) | |
| tree | 6f9a8e31b43266591c160a945fd134c8f60b9bb3 /src/compiler/GF/CompileInParallel.hs | |
| parent | e41d9e34bbb93a594b09fa390140149897a9112f (diff) | |
Use terminfo to highlight warnings and errors in blue and red
This replaces the hardwired ANSI escape codes that were accidentally included
in a previous patch.
This adds a dependency on terminfo, but this should be unproblematic, since
haskeline already depends on the same underlying C library.
The color highlighting is omitted on Windows.
Diffstat (limited to 'src/compiler/GF/CompileInParallel.hs')
| -rw-r--r-- | src/compiler/GF/CompileInParallel.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/GF/CompileInParallel.hs b/src/compiler/GF/CompileInParallel.hs index a70741971..22a53a841 100644 --- a/src/compiler/GF/CompileInParallel.hs +++ b/src/compiler/GF/CompileInParallel.hs @@ -17,6 +17,7 @@ import GF.Data.Operations import GF.Grammar.Grammar(emptyGrammar,prependModule) import GF.Infra.Ident(moduleNameS) import GF.Text.Pretty +import GF.System.Console(TermColors(..),getTermColors) import qualified Data.ByteString.Lazy as BS -- | Compile the given grammar files and everything they depend on, @@ -81,13 +82,15 @@ batchCompile1 lib_dir (opts,filepaths) = ppPath ps = "-path="<>intercalate ":" (map rel ps) deps <- newMVar M.empty toLog <- newLog runIOE + term <- getTermColors let --logStrLn = toLog . ePutStrLn --ok :: CollectOutput IO a -> IO a ok (CO m) = err bad good =<< appIOE m where good (o,r) = do toLog o; return r bad e = do toLog (redPutStrLn e); fail "failed" - redPutStrLn s = do ePutStr "\ESC[31m";ePutStr s;ePutStrLn "\ESC[m" + redPutStrLn s = do ePutStr (redFg term);ePutStr s + ePutStrLn (restore term) sgr <- liftIO $ newMVar emptyGrammar let extendSgr sgr m = modifyMVar_ sgr $ \ gr -> |
