Permalink
Browse files

Use 'putStr' for printing last 10 lines of the build log.

Fixes #1070.
  • Loading branch information...
1 parent 0f82cb9 commit 48536dfd6694a2ac222e0d50e00f869fe7a7d431 @23Skidoo 23Skidoo committed Oct 17, 2012
Showing with 10 additions and 9 deletions.
  1. +10 −9 cabal-install/Distribution/Client/Install.hs
@@ -121,7 +121,7 @@ import Distribution.System
import Distribution.Text
( display )
import Distribution.Verbosity as Verbosity
- ( Verbosity, showForCabal, verbose, deafening )
+ ( Verbosity, showForCabal, normal, verbose, deafening )
import Distribution.Simple.BuildPaths ( exeExtension )
--TODO:
@@ -932,20 +932,21 @@ executeInstallPlan verbosity jobCtl useLogFile plan0 installPkg =
(Right _) -> notice verbosity $ "Installed " ++ display pkgid
(Left _) -> do
notice verbosity $ "Failed to install " ++ display pkgid
- case useLogFile of
- Nothing -> return ()
- Just (mkLogFileName, _) -> do
- let (logName, n) = (mkLogFileName pkgid, 10)
- notice verbosity $ "Last " ++ (show n)
- ++ " lines of the build log ( " ++ logName ++ " ):"
- printLastNLines logName n
+ when (verbosity >= normal) $
+ case useLogFile of
+ Nothing -> return ()
+ Just (mkLogFileName, _) -> do
+ let (logName, n) = (mkLogFileName pkgid, 10)
+ putStr $ "Last " ++ (show n)
+ ++ " lines of the build log ( " ++ logName ++ " ):"
+ printLastNLines logName n
printLastNLines :: FilePath -> Int -> IO ()
printLastNLines path n = do
lns <- fmap lines $ readFile path
let len = length lns
let toDrop = if len > n && n > 0 then (len - n) else 0
- mapM_ (notice verbosity) (drop toDrop lns)
+ mapM_ putStr (drop toDrop lns)
-- | Call an installer for an 'SourcePackage' but override the configure
-- flags with the ones given by the 'ConfiguredPackage'. In particular the

0 comments on commit 48536df

Please sign in to comment.