mirror of
https://github.com/docker/compose.git
synced 2025-07-23 21:54:40 +02:00
Merge pull request #1495 from docker/no_service
deadlock waiting for services when none selected
This commit is contained in:
commit
74277f3496
@ -235,6 +235,10 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(project.Services) == 0 {
|
||||||
|
return fmt.Errorf("no service selected")
|
||||||
|
}
|
||||||
|
|
||||||
_, err = progress.Run(ctx, func(ctx context.Context) (string, error) {
|
_, err = progress.Run(ctx, func(ctx context.Context) (string, error) {
|
||||||
err := c.ComposeService().Create(ctx, project, compose.CreateOptions{
|
err := c.ComposeService().Create(ctx, project, compose.CreateOptions{
|
||||||
Services: services,
|
Services: services,
|
||||||
@ -302,7 +306,7 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
|
|||||||
var exitCode int
|
var exitCode int
|
||||||
eg, ctx := errgroup.WithContext(ctx)
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
eg.Go(func() error {
|
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
|
exitCode = code
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
@ -396,7 +400,7 @@ type printer struct {
|
|||||||
queue chan compose.ContainerEvent
|
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 aborting bool
|
||||||
var count int
|
var count int
|
||||||
for {
|
for {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user