Skip to content

Commit abd02b6

Browse files
committed
cli-plugins/manager: ListPlugins: pass context to error-group
This error-group was added in 89583b9, but passed a context.TODO because the function didn't have a context as argument. However, it does get the root-command passed, which holds the context, so we can pass that. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 2d74733 commit abd02b6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cli-plugins/manager/manager.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ func ListPlugins(dockerCli config.Provider, rootcmd *cobra.Command) ([]Plugin, e
154154

155155
var plugins []Plugin
156156
var mu sync.Mutex
157-
eg, _ := errgroup.WithContext(context.TODO())
157+
ctx := rootcmd.Context()
158+
if ctx == nil {
159+
// Fallback, mostly for tests that pass a bare cobra.command
160+
ctx = context.Background()
161+
}
162+
eg, _ := errgroup.WithContext(ctx)
158163
cmds := rootcmd.Commands()
159164
for _, paths := range candidates {
160165
func(paths []string) {

0 commit comments

Comments
 (0)