Avoid deadlock in unpacker.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
5
pull.go
5
pull.go
@@ -70,6 +70,11 @@ func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (_ Ima
|
||||
}
|
||||
unpackWrapper, eg := u.handlerWrapper(ctx, &unpacks)
|
||||
defer func() {
|
||||
if retErr != nil {
|
||||
// Forcibly stop the unpacker if there is
|
||||
// an error.
|
||||
eg.Cancel()
|
||||
}
|
||||
if err := eg.Wait(); err != nil {
|
||||
if retErr == nil {
|
||||
retErr = errors.Wrap(err, "unpack")
|
||||
|
Reference in New Issue
Block a user