diff --git a/common/task/task.go b/common/task/task.go index dfc8cdef..5403481c 100644 --- a/common/task/task.go +++ b/common/task/task.go @@ -87,16 +87,18 @@ func (g *Group) RunContextList(contextList []context.Context) error { } selectedContext, upstreamErr := common.SelectContext(append([]context.Context{taskCancelContext}, contextList...)) - if selectedContext != 0 { - returnError = E.Append(returnError, upstreamErr, func(err error) error { - return E.Cause(err, "upstream") - }) - } if g.cleanup != nil { g.cleanup() } <-taskContext.Done() + + if selectedContext != 0 { + returnError = E.Append(returnError, upstreamErr, func(err error) error { + return E.Cause(err, "upstream") + }) + } + return returnError }