[Git][ghc/ghc][wip/T18835] hadrian: Suppress xelatex output unless it fails

Ben Gamari gitlab at gitlab.haskell.org
Mon Oct 19 15:29:58 UTC 2020



Ben Gamari pushed to branch wip/T18835 at Glasgow Haskell Compiler / GHC


Commits:
6abe51a1 by Ben Gamari at 2020-10-19T11:29:45-04:00
hadrian: Suppress xelatex output unless it fails

As noted in #18835, xelatex produces an absurd amount of output, nearly
all of which is meaningless. Silence this.

Fixes #18835.

- - - - -


1 changed file:

- hadrian/src/Builder.hs


Changes:

=====================================
hadrian/src/Builder.hs
=====================================
@@ -27,6 +27,8 @@ import Hadrian.Oracles.Path
 import Hadrian.Oracles.TextFile
 import Hadrian.Utilities
 
+import qualified Data.ByteString.Lazy.Char8 as BSL
+
 import Base
 import Context
 import Oracles.Flag
@@ -286,7 +288,18 @@ instance H.Builder Builder where
                 Makeinfo -> do
                   cmd' echo [path] "--no-split" [ "-o", output] [input]
 
-                Xelatex   -> unit $ cmd' [Cwd output] [path] buildArgs
+                Xelatex   ->
+                  -- xelatex produces an incredible amount of output, almost
+                  -- all of which is useless. Suppress it unless user
+                  -- requests a loud build.
+                  if verbosity >= Loud
+                    then cmd' [Cwd output] [path] buildArgs
+                    else do (Stdouterr out, Exit code) <- cmd' [Cwd output] [path] buildArgs
+                            when (code /= ExitSuccess) $
+                              BSL.hPutStrLn stderr out
+                            putFailure "xelatex failed!"
+                            fail "xelatex failed"
+
                 Makeindex -> unit $ cmd' [Cwd output] [path] (buildArgs ++ [input])
 
                 Tar _ -> cmd' buildOptions echo [path] buildArgs



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6abe51a19efda90ff37b8311cc054713ce316ffb

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6abe51a19efda90ff37b8311cc054713ce316ffb
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201019/3255a744/attachment-0001.html>


More information about the ghc-commits mailing list