From aade09e74eaae1eb704fbad86e3935ee71ab73eb Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 12 Mar 2014 18:13:01 +0400 Subject: [PATCH] Shutdown progress bar in any case. --- http/download.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/http/download.go b/http/download.go index 6a20f64b..447b35cd 100644 --- a/http/download.go +++ b/http/download.go @@ -218,20 +218,18 @@ func DownloadTempWithChecksum(downloader aptly.Downloader, url string, expected if expected.Size != -1 && downloader.GetProgress() != nil { downloader.GetProgress().InitBar(expected.Size, true) + defer downloader.GetProgress().ShutdownBar() } ch := make(chan error, 1) downloader.DownloadWithChecksum(url, tempfile, ch, expected, ignoreMismatch) err = <-ch + if err != nil { return nil, err } - if expected.Size != -1 && downloader.GetProgress() != nil { - downloader.GetProgress().ShutdownBar() - } - file, err := os.Open(tempfile) if err != nil { return nil, err