1
0
mirror of https://github.com/containers/skopeo.git synced 2025-05-05 22:47:06 +00:00

fix containers/image progress

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-09-26 16:48:18 +02:00
parent 5b7fcc8eca
commit 0420fa0299
No known key found for this signature in database
GPG Key ID: B2BEAD150DE936B9

View File

@ -91,11 +91,12 @@ type Options struct {
// Image copies image from srcRef to destRef, using policyContext to validate source image admissibility.
func Image(ctx *types.SystemContext, policyContext *signature.PolicyContext, destRef, srcRef types.ImageReference, options *Options) error {
if options.ReportWriter == nil {
options.ReportWriter = ioutil.Discard
reportWriter := options.ReportWriter
if reportWriter == nil {
reportWriter = ioutil.Discard
}
writeReport := func(f string, a ...interface{}) {
fmt.Fprintf(options.ReportWriter, f, a...)
fmt.Fprintf(reportWriter, f, a...)
}
dest, err := destRef.NewImageDestination(ctx)
if err != nil {
@ -270,11 +271,7 @@ func copyBlob(dest types.ImageDestination, src types.ImageSource, srcInfo types.
bar.Start()
destStream = bar.NewProxyReader(destStream)
defer func() {
if err != nil {
fmt.Fprint(reportWriter, "\n")
}
}()
defer fmt.Fprint(reportWriter, "\n")
var inputInfo types.BlobInfo
if !canCompress || isCompressed || !dest.ShouldCompressLayers() {