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]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [ ]  No 

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #1720 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Vaibhav Kamra 2022-12-29 08:44:19 -08:00 committed by GitHub
parent 3447e47951
commit 5fec5ccd11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Fixed
- Fixed issue where repository connect progress bar was clobbering backup/restore operation output.
## [v0.0.4] (alpha) ## [v0.0.4] (alpha)
### Added ### Added

View File

@ -150,6 +150,10 @@ func Connect(
s storage.Storage, s storage.Storage,
opts control.Options, opts control.Options,
) (Repository, error) { ) (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:") complete, closer := observe.MessageWithCompletion("Connecting to repository:")
defer closer() defer closer()
defer close(complete) defer close(complete)