Skip to content

Commit 0b70f6e

Browse files
committed
cli/command/image: close ProgressReader
progress.NewProgressReader implements io.ReadCloser. client.ImageBuild only requests an io.Reader, and there's some code in place to assert if the passed io.Reader was an io.ReadCloser, but let's make sure it's closed just in case. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 63158f7 commit 0b70f6e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cli/command/image/build.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,10 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions)
315315
buildCtx = dockerfileCtx
316316
}
317317

318-
var body io.Reader
318+
var body io.ReadCloser
319319
if buildCtx != nil {
320320
body = progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
321+
defer func() { _ = body.Close() }()
321322
}
322323

323324
configFile := dockerCli.ConfigFile()

0 commit comments

Comments
 (0)