Skip to content

Commit

Permalink
Merge pull request #8726 from ndeloof/log_follow_killed
Browse files Browse the repository at this point in the history
`log --follow` must stop when container get killed
  • Loading branch information
Ulysses Souza authored Oct 6, 2021
2 parents c55fde7 + 4af04b2 commit 0062703
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/compose/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0062703

Please sign in to comment.