Skip to content

Commit 259b47f

Browse files
authored
Merge pull request #6177 from develop7/fix-ellipsize-progress
Ellipsize build progress output line
2 parents 6dae9f7 + cd4626d commit 259b47f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Release notes:
66

77
* Further to the release notes for Stack 2.3.1, the `-static` suffix has been
88
removed from the statically linked Linux/x86_64 binaries.
9+
* The build progress line gets ellipsized in order to fit one terminal line
10+
matching cargo behavior and preventing logSticky spam on narrow
11+
terminals and lots of dependencies building simultaneously
912

1013
**Changes since v2.11.1:**
1114

src/Stack/Build/Execute.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,7 @@ executePlan' installedMap0 targets plan ee@ExecuteEnv {..} = do
785785
let keepGoing =
786786
fromMaybe (not (Map.null (planFinals plan))) (boptsKeepGoing eeBuildOpts)
787787
terminal <- view terminalL
788+
terminalWidth <- view termWidthL
788789
errs <- liftIO $ runActions threads keepGoing actions $
789790
\doneVar actionsVar -> do
790791
let total = length actions
@@ -803,10 +804,16 @@ executePlan' installedMap0 targets plan ee@ExecuteEnv {..} = do
803804
": "
804805
: L.intersperse ", "
805806
(map (fromString . packageNameString) names)
807+
progressLine prev' total' =
808+
"Progress " <> display prev' <> "/" <> display total' <>
809+
nowBuilding packageNames
810+
ellipsize n text =
811+
if T.length text <= n
812+
then text
813+
else T.take (n - 1) text <> ""
806814
when terminal $ run $
807-
logSticky $
808-
"Progress " <> display prev <> "/" <> display total <>
809-
nowBuilding packageNames
815+
logSticky $ display $ ellipsize terminalWidth $
816+
utf8BuilderToText $ progressLine prev total
810817
done <- atomically $ do
811818
done <- readTVar doneVar
812819
check $ done /= prev

0 commit comments

Comments
 (0)