From 4af04b23ec0f3dc07b91b78b64a99bb229eff3ad Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 1 Oct 2021 14:13:51 +0200 Subject: [PATCH] `log --follow` must stop when container get killed Signed-off-by: Nicolas De Loof --- pkg/compose/logs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/compose/logs.go b/pkg/compose/logs.go index 5544c4923..e586130c1 100644 --- a/pkg/compose/logs.go +++ b/pkg/compose/logs.go @@ -35,12 +35,16 @@ func (s *composeService) Logs(ctx context.Context, projectName string, consumer eg, ctx := errgroup.WithContext(ctx) if options.Follow { + printer := newLogPrinter(consumer) eg.Go(func() error { - printer := newLogPrinter(consumer) return s.watchContainers(ctx, projectName, options.Services, printer.HandleEvent, containers, func(c types.Container) error { return s.logContainers(ctx, consumer, c, options) }) }) + eg.Go(func() error { + _, err := printer.Run(false, "", nil) + return err + }) } for _, c := range containers {