From eb188e0514219d2371b4782d42cf228e0292829f Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Thu, 26 Oct 2023 22:16:17 +0530 Subject: [PATCH] Fix export stalling when run with progressbars (#4554) Exports were stalling when run with progressbars. Most of our tests(except for longevity tests) did not catch this as they were running without progressbars. This should fix that. First introduced in 040257f8be95f924fce3adcb1159422a1f22b45c --- #### 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: Supportability/Tests - [ ] :computer: CI/Deployment - [ ] :broom: Tech Debt/Cleanup #### Issue(s) * # #### Test Plan - [ ] :muscle: Manual - [ ] :zap: Unit test - [x] :green_heart: E2E --- CHANGELOG.md | 1 + src/cli/export/export.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8677a27b1..fff7464bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - SharePoint backup would fail if any site had an empty display name +- Fix a bug with exports hanging post completion ## [v0.14.2] (beta) - 2023-10-17 diff --git a/src/cli/export/export.go b/src/cli/export/export.go index aeaf8f3e7..774d27904 100644 --- a/src/cli/export/export.go +++ b/src/cli/export/export.go @@ -104,9 +104,15 @@ func runExport( // It would be better to give a progressbar than a spinner, but we // have any way of knowing how many files are available as of now. diskWriteComplete := observe.MessageWithCompletion(ctx, "Writing data to disk") - defer close(diskWriteComplete) err = export.ConsumeExportCollections(ctx, exportLocation, expColl, eo.Errors) + + // The progressbar has to be closed before we move on as the Infof + // below flushes progressbar to prevent clobbering the output and + // that causes the entire export operation to stall indefinitely. + // https://github.com/alcionai/corso/blob/8102523dc62c001b301cd2ab4e799f86146ab1a0/src/cli/print/print.go#L151 + close(diskWriteComplete) + if err != nil { return Only(ctx, err) }