From 21abe3cd293f060e81c5afe2130ae9f4ebc918a7 Mon Sep 17 00:00:00 2001
From: Mikhail Glushenkov <the.dead.shall.rise@gmail.com>
Date: Fri, 19 Apr 2013 00:07:36 +0200
Subject: [PATCH] Fix printing of the last 10 lines of the error log with -j
 (again).

Fixes #1271.
---
 cabal-install/Distribution/Client/Install.hs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/cabal-install/Distribution/Client/Install.hs b/cabal-install/Distribution/Client/Install.hs
index 2e946217ef..41032677d3 100644
--- a/cabal-install/Distribution/Client/Install.hs
+++ b/cabal-install/Distribution/Client/Install.hs
@@ -969,17 +969,18 @@ executeInstallPlan verbosity jobCtl useLogFile plan0 installPkg =
             case useLogFile of
               Nothing                 -> return ()
               Just (mkLogFileName, _) -> do
-                let (logName, n) = (mkLogFileName pkgid, 10)
+                let logName = mkLogFileName pkgid
+                    n       = 10
                 putStr $ "Last " ++ (show n)
-                  ++ " lines of the build log ( " ++ logName ++ " ):"
+                  ++ " lines of the build log ( " ++ logName ++ " ):\n"
                 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_ putStr (drop toDrop lns)
+      let toDrop = if (len > n && n > 0) then (len - n) else 0
+      mapM_ putStrLn (drop toDrop lns)
 
 -- | Call an installer for an 'SourcePackage' but override the configure
 -- flags with the ones given by the 'ConfiguredPackage'. In particular the
-- 
GitLab