From 5fec5ccd11e960a2b699aba1aca947e355b57d3c Mon Sep 17 00:00:00 2001 From: Vaibhav Kamra Date: Thu, 29 Dec 2022 08:44:19 -0800 Subject: [PATCH] Fix repo connect progress bar clobbering output (#1990) ## Description The Backup/Restore operations ensure progress bars are completed before logging to stdout. When a progress bar was added to repo connect - this is outside of that scope and ends up not getting shutdown correctly. This fixes that by adding a `observe.Complete()` in `Connect`. ## Does this PR need a docs update or release note? - [x] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [ ] :no_entry: No ## Type of change - [ ] :sunflower: Feature - [x] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Test - [ ] :computer: CI/Deployment - [ ] :hamster: Trivial/Minor ## Issue(s) * #1720 ## Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- CHANGELOG.md | 4 ++++ src/pkg/repository/repository.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b358ba0c4..3b6d0236a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed issue where repository connect progress bar was clobbering backup/restore operation output. + ## [v0.0.4] (alpha) ### Added diff --git a/src/pkg/repository/repository.go b/src/pkg/repository/repository.go index 42a530d7e..c309723e5 100644 --- a/src/pkg/repository/repository.go +++ b/src/pkg/repository/repository.go @@ -150,6 +150,10 @@ func Connect( s storage.Storage, opts control.Options, ) (Repository, error) { + // Close/Reset the progress bar. This ensures callers don't have to worry about + // their output getting clobbered (#1720) + defer observe.Complete() + complete, closer := observe.MessageWithCompletion("Connecting to repository:") defer closer() defer close(complete)