Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 74277f3

Browse files
authored
Merge pull request #1495 from docker/no_service
deadlock waiting for services when none selected
2 parents 5b61e80 + 0595822 commit 74277f3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cli/cmd/compose/up.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
235235
return err
236236
}
237237

238+
if len(project.Services) == 0 {
239+
return fmt.Errorf("no service selected")
240+
}
241+
238242
_, err = progress.Run(ctx, func(ctx context.Context) (string, error) {
239243
err := c.ComposeService().Create(ctx, project, compose.CreateOptions{
240244
Services: services,
@@ -302,7 +306,7 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
302306
var exitCode int
303307
eg, ctx := errgroup.WithContext(ctx)
304308
eg.Go(func() error {
305-
code, err := printer.run(ctx, opts.cascadeStop, opts.exitCodeFrom, consumer, stopFunc)
309+
code, err := printer.run(opts.cascadeStop, opts.exitCodeFrom, consumer, stopFunc)
306310
exitCode = code
307311
return err
308312
})
@@ -396,7 +400,7 @@ type printer struct {
396400
queue chan compose.ContainerEvent
397401
}
398402

399-
func (p printer) run(ctx context.Context, cascadeStop bool, exitCodeFrom string, consumer compose.LogConsumer, stopFn func() error) (int, error) { //nolint:unparam
403+
func (p printer) run(cascadeStop bool, exitCodeFrom string, consumer compose.LogConsumer, stopFn func() error) (int, error) {
400404
var aborting bool
401405
var count int
402406
for {

0 commit comments

Comments
 (0)