Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/compose/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func (s *composeService) Logs(
}
})
eg.Go(func() error {
// pass ctx so monitor will immediately stop on SIGINT
return monitor.Start(ctx)
})
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/compose/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (c *monitor) Start(ctx context.Context) error {
}
restarting := utils.Set[string]{}

evtCh, errCh := c.api.Events(context.Background(), events.ListOptions{
evtCh, errCh := c.api.Events(ctx, events.ListOptions{
Filters: filters.NewArgs(
filters.Arg("type", "container"),
projectFilter(c.project)),
Expand All @@ -89,6 +89,8 @@ func (c *monitor) Start(ctx context.Context) error {
return nil
}
select {
case <-ctx.Done():
return nil
case err := <-errCh:
return err
case event := <-evtCh:
Expand Down