Commit 48536dfd authored by refold's avatar refold
Browse files

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

Fixes #1070.
parent 0f82cb9e
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment