@@ -298,13 +298,17 @@ func (s *composeService) removeVolume(ctx context.Context, id string, w progress
298
298
return err
299
299
}
300
300
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 {
302
306
eventName := getContainerProgressName (ctr )
303
307
w .Event (progress .StoppingEvent (eventName ))
304
308
305
309
if service != nil {
306
310
for _ , hook := range service .PreStop {
307
- err := s .runHook (ctx , ctr , * service , hook , nil )
311
+ err := s .runHook (ctx , ctr , * service , hook , listener )
308
312
if err != nil {
309
313
// Ignore errors indicating that some containers were already stopped or removed.
310
314
if cerrdefs .IsNotFound (err ) || cerrdefs .IsConflict (err ) {
@@ -325,11 +329,15 @@ func (s *composeService) stopContainer(ctx context.Context, w progress.Writer, s
325
329
return nil
326
330
}
327
331
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 {
329
337
eg , ctx := errgroup .WithContext (ctx )
330
338
for _ , ctr := range containers {
331
339
eg .Go (func () error {
332
- return s .stopContainer (ctx , w , serv , ctr , timeout )
340
+ return s .stopContainer (ctx , w , serv , ctr , timeout , listener )
333
341
})
334
342
}
335
343
return eg .Wait ()
@@ -348,7 +356,7 @@ func (s *composeService) removeContainers(ctx context.Context, containers []cont
348
356
func (s * composeService ) stopAndRemoveContainer (ctx context.Context , ctr containerType.Summary , service * types.ServiceConfig , timeout * time.Duration , volumes bool ) error {
349
357
w := progress .ContextWriter (ctx )
350
358
eventName := getContainerProgressName (ctr )
351
- err := s .stopContainer (ctx , w , service , ctr , timeout )
359
+ err := s .stopContainer (ctx , w , service , ctr , timeout , nil )
352
360
if cerrdefs .IsNotFound (err ) {
353
361
w .Event (progress .RemovedEvent (eventName ))
354
362
return nil
0 commit comments