@@ -298,13 +298,17 @@ func (s *composeService) removeVolume(ctx context.Context, id string, w progress
298298 return err
299299}
300300
301- func (s * composeService ) stopContainer (ctx context.Context , w progress.Writer , service * types.ServiceConfig , ctr containerType.Summary , timeout * time.Duration ) error {
301+ func (s * composeService ) stopContainer (
302+ ctx context.Context , w progress.Writer ,
303+ service * types.ServiceConfig , ctr containerType.Summary ,
304+ timeout * time.Duration , listener api.ContainerEventListener ,
305+ ) error {
302306 eventName := getContainerProgressName (ctr )
303307 w .Event (progress .StoppingEvent (eventName ))
304308
305309 if service != nil {
306310 for _ , hook := range service .PreStop {
307- err := s .runHook (ctx , ctr , * service , hook , nil )
311+ err := s .runHook (ctx , ctr , * service , hook , listener )
308312 if err != nil {
309313 // Ignore errors indicating that some containers were already stopped or removed.
310314 if cerrdefs .IsNotFound (err ) || cerrdefs .IsConflict (err ) {
@@ -325,11 +329,15 @@ func (s *composeService) stopContainer(ctx context.Context, w progress.Writer, s
325329 return nil
326330}
327331
328- func (s * composeService ) stopContainers (ctx context.Context , w progress.Writer , serv * types.ServiceConfig , containers []containerType.Summary , timeout * time.Duration ) error {
332+ func (s * composeService ) stopContainers (
333+ ctx context.Context , w progress.Writer ,
334+ serv * types.ServiceConfig , containers []containerType.Summary ,
335+ timeout * time.Duration , listener api.ContainerEventListener ,
336+ ) error {
329337 eg , ctx := errgroup .WithContext (ctx )
330338 for _ , ctr := range containers {
331339 eg .Go (func () error {
332- return s .stopContainer (ctx , w , serv , ctr , timeout )
340+ return s .stopContainer (ctx , w , serv , ctr , timeout , listener )
333341 })
334342 }
335343 return eg .Wait ()
@@ -348,7 +356,7 @@ func (s *composeService) removeContainers(ctx context.Context, containers []cont
348356func (s * composeService ) stopAndRemoveContainer (ctx context.Context , ctr containerType.Summary , service * types.ServiceConfig , timeout * time.Duration , volumes bool ) error {
349357 w := progress .ContextWriter (ctx )
350358 eventName := getContainerProgressName (ctr )
351- err := s .stopContainer (ctx , w , service , ctr , timeout )
359+ err := s .stopContainer (ctx , w , service , ctr , timeout , nil )
352360 if cerrdefs .IsNotFound (err ) {
353361 w .Event (progress .RemovedEvent (eventName ))
354362 return nil
0 commit comments