diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-10-12 18:21:22 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-10-26 10:15:22 -0400 |
commit | d963882ed1c55f262bbc93f30fbc7a636d1d908b (patch) | |
tree | c099b90749f5b65d58a9f590e948484a284ee93e | |
parent | 730bb59086ad1036143983c3fba61bd851bebc03 (diff) | |
download | haskell-wip/T18835.tar.gz |
hadrian: Suppress xelatex output unless it failswip/T18835
As noted in #18835, xelatex produces an absurd amount of output, nearly
all of which is meaningless. Silence this.
Fixes #18835.
-rw-r--r-- | hadrian/hadrian.cabal | 1 | ||||
-rw-r--r-- | hadrian/src/Builder.hs | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal index 611cd20796..e78668e3a2 100644 --- a/hadrian/hadrian.cabal +++ b/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 diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs index 5d7ff33720..18a64b372b 100644 --- a/hadrian/src/Builder.hs +++ b/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 |