Skip to content

Commit 348cfec

Browse files
authored
Fix status bar updates getting lost (#389)
* Fix status bar updates getting lost * Add changelog entry
1 parent 24badc8 commit 348cfec

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All notable changes to `src-cli` are documented in this file.
1818
### Fixed
1919

2020
- If `src campaign [validate|apply|preview]` was aborted while it was downloading repository archives it could leave behind partial ZIP files that would produce an error on the next run. This is now fixed by deleting partial files on abort. [#388](https://github.com/sourcegraph/src-cli/pull/388)
21+
- A bug in `src campaign [apply|preview]` that would cause status bars in the TUI to not update has been fixed. [#389](https://github.com/sourcegraph/src-cli/pull/389)
2122

2223
### Removed
2324

cmd/src/campaign_progress_printer.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ func newCampaignProgressPrinter(out *output.Output, numParallelism int) *campaig
2424
}
2525

2626
type campaignProgressPrinter struct {
27-
out *output.Output
28-
progress output.ProgressWithStatusBars
27+
out *output.Output
28+
29+
progress output.ProgressWithStatusBars
30+
numStatusBars int
2931

3032
maxRepoName int
3133
numParallelism int
@@ -67,9 +69,8 @@ func (p *campaignProgressPrinter) PrintStatuses(statuses []*campaigns.TaskStatus
6769
return
6870
}
6971

70-
var numStatusBars int
7172
if p.progress == nil {
72-
numStatusBars = p.initProgressBar(statuses)
73+
p.numStatusBars = p.initProgressBar(statuses)
7374
}
7475

7576
newlyCompleted := []*campaigns.TaskStatus{}
@@ -120,7 +121,7 @@ func (p *campaignProgressPrinter) PrintStatuses(statuses []*campaigns.TaskStatus
120121
_, ok = p.statusBarRepo[statusBarIndex]
121122
}
122123

123-
if statusBarIndex >= numStatusBars {
124+
if statusBarIndex >= p.numStatusBars {
124125
// If the only free slot is past the number of status bars we
125126
// have, there's a race condition going on where we have more tasks
126127
// reporting as "currently executing" than could be executing, most

0 commit comments

Comments
 (0)