From 05958228acb53f8a21da8a8e0c0509db18f972ce Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 6 Apr 2021 10:37:31 +0200 Subject: [PATCH] deadlock waiting for services when none selected Signed-off-by: Nicolas De Loof --- cli/cmd/compose/up.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/cmd/compose/up.go b/cli/cmd/compose/up.go index 7feb5a4fe..306805468 100644 --- a/cli/cmd/compose/up.go +++ b/cli/cmd/compose/up.go @@ -235,6 +235,10 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro return err } + if len(project.Services) == 0 { + return fmt.Errorf("no service selected") + } + _, err = progress.Run(ctx, func(ctx context.Context) (string, error) { err := c.ComposeService().Create(ctx, project, compose.CreateOptions{ Services: services, @@ -302,7 +306,7 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro var exitCode int eg, ctx := errgroup.WithContext(ctx) eg.Go(func() error { - code, err := printer.run(ctx, opts.cascadeStop, opts.exitCodeFrom, consumer, stopFunc) + code, err := printer.run(opts.cascadeStop, opts.exitCodeFrom, consumer, stopFunc) exitCode = code return err }) @@ -396,7 +400,7 @@ type printer struct { queue chan compose.ContainerEvent } -func (p printer) run(ctx context.Context, cascadeStop bool, exitCodeFrom string, consumer compose.LogConsumer, stopFn func() error) (int, error) { //nolint:unparam +func (p printer) run(cascadeStop bool, exitCodeFrom string, consumer compose.LogConsumer, stopFn func() error) (int, error) { var aborting bool var count int for {