Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

@23Skidoo
Collaborator

Fixes #1070.

@tibbe
Owner

Are there any serialization concerns for parallel builds?

@23Skidoo
Collaborator

You mean stdout output serialisation? Worker threads don't print anything to the stdout and this function is called only from the main thread.

@tibbe
Owner

Great, thanks for clarifying.

@tibbe tibbe merged commit 48536df into haskell:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 17, 2012
  1. @23Skidoo
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 9 deletions.
  1. +10 −9 cabal-install/Distribution/Client/Install.hs
View
19 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
Something went wrong with that request. Please try again.