mirror of
https://github.com/docker/compose.git
synced 2026-02-09 01:59:22 +08:00
fix race-condition bug in publish command
Signed-off-by: Paul Thiele <paul.thiele@kinexon.com>
This commit is contained in:
committed by
Nicolas De loof
parent
88aae9c46e
commit
157617480a
@@ -125,10 +125,13 @@ func Push(ctx context.Context, resolver remotes.Resolver, ref reference.Named, d
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = push.Close()
|
||||
}()
|
||||
|
||||
_, err = push.Write(descriptor.Data)
|
||||
return err
|
||||
if err != nil {
|
||||
// Close the writer on error since Commit won't be called
|
||||
_ = push.Close()
|
||||
return err
|
||||
}
|
||||
// Commit will close the writer
|
||||
return push.Commit(ctx, int64(len(descriptor.Data)), descriptor.Digest)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user