mirror of
https://github.com/docker/compose.git
synced 2026-08-27 03:45:29 +00:00
fix race-condition bug in publish command
Signed-off-by: Paul Thiele <paul.thiele@kinexon.com>
This commit is contained in:
parent
88aae9c46e
commit
157617480a
1 changed files with 7 additions and 4 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue