[Git][ghc/ghc][master] hadrian: Suppress xelatex output unless it fails
Marge Bot
gitlab at gitlab.haskell.org
Tue Oct 27 18:01:33 UTC 2020
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
4950dd07 by Ben Gamari at 2020-10-27T14:01:24-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.
- - - - -
2 changed files:
- hadrian/hadrian.cabal
- hadrian/src/Builder.hs
Changes:
=====================================
hadrian/hadrian.cabal
=====================================
@@ -138,6 +138,7 @@ executable hadrian
build-depends: Cabal >= 3.0 && < 3.3
, QuickCheck >= 2.6 && < 2.14
, base >= 4.8 && < 5
+ , bytestring >= 0.10 && < 0.12
, containers >= 0.5 && < 0.7
, directory >= 1.3.1.0 && < 1.4
, extra >= 1.4.7
=====================================
hadrian/src/Builder.hs
=====================================
@@ -15,6 +15,7 @@ module Builder (
) where
import Control.Exception.Extra (Partial)
+import qualified Data.ByteString.Lazy.Char8 as BSL
import Development.Shake.Classes
import Development.Shake.Command
import GHC.Generics
@@ -26,6 +27,8 @@ import Hadrian.Builder.Tar
import Hadrian.Oracles.Path
import Hadrian.Oracles.TextFile
import Hadrian.Utilities
+import System.Exit
+import System.IO (stderr)
import Base
import Context
@@ -286,7 +289,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) $ do
+ liftIO $ 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/4950dd075ce79e13d24362d669e134ed5a4ddec7
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4950dd075ce79e13d24362d669e134ed5a4ddec7
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/20201027/20fd6262/attachment-0001.html>
More information about the ghc-commits
mailing list