mirror of https://github.com/docker/compose.git
`log --follow` must stop when container get killed
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
0a81a98b7d
commit
4af04b23ec
|
@ -35,12 +35,16 @@ func (s *composeService) Logs(ctx context.Context, projectName string, consumer
|
||||||
|
|
||||||
eg, ctx := errgroup.WithContext(ctx)
|
eg, ctx := errgroup.WithContext(ctx)
|
||||||
if options.Follow {
|
if options.Follow {
|
||||||
|
printer := newLogPrinter(consumer)
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
printer := newLogPrinter(consumer)
|
|
||||||
return s.watchContainers(ctx, projectName, options.Services, printer.HandleEvent, containers, func(c types.Container) error {
|
return s.watchContainers(ctx, projectName, options.Services, printer.HandleEvent, containers, func(c types.Container) error {
|
||||||
return s.logContainers(ctx, consumer, c, options)
|
return s.logContainers(ctx, consumer, c, options)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
eg.Go(func() error {
|
||||||
|
_, err := printer.Run(false, "", nil)
|
||||||
|
return err
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range containers {
|
for _, c := range containers {
|
||||||
|
|
Loading…
Reference in New Issue