mirror of
https://github.com/docker/compose.git
synced 2025-07-25 14:44:29 +02:00
avoid duplicated "xx exited with code 0" message
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
8ab8df86e0
commit
e99b8acea7
@ -86,7 +86,8 @@ func (p *printer) Run(cascadeStop bool, exitCodeFrom string, stopFn func() error
|
|||||||
)
|
)
|
||||||
defer p.Stop()
|
defer p.Stop()
|
||||||
|
|
||||||
containers := map[string]struct{}{}
|
// containers we are tracking. Use true when container is running, false after we receive a stop|die signal
|
||||||
|
containers := map[string]bool{}
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-p.stopCh:
|
case <-p.stopCh:
|
||||||
@ -100,18 +101,20 @@ func (p *printer) Run(cascadeStop bool, exitCodeFrom string, stopFn func() error
|
|||||||
if _, ok := containers[id]; ok {
|
if _, ok := containers[id]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
containers[id] = struct{}{}
|
containers[id] = true
|
||||||
p.consumer.Register(container)
|
p.consumer.Register(container)
|
||||||
case api.ContainerEventExit, api.ContainerEventStopped, api.ContainerEventRecreated:
|
case api.ContainerEventExit, api.ContainerEventStopped, api.ContainerEventRecreated:
|
||||||
if !event.Restarting {
|
if !aborting && containers[id] {
|
||||||
delete(containers, id)
|
|
||||||
}
|
|
||||||
if !aborting {
|
|
||||||
p.consumer.Status(container, fmt.Sprintf("exited with code %d", event.ExitCode))
|
p.consumer.Status(container, fmt.Sprintf("exited with code %d", event.ExitCode))
|
||||||
if event.Type == api.ContainerEventRecreated {
|
if event.Type == api.ContainerEventRecreated {
|
||||||
p.consumer.Status(container, "has been recreated")
|
p.consumer.Status(container, "has been recreated")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
containers[id] = false
|
||||||
|
if !event.Restarting {
|
||||||
|
delete(containers, id)
|
||||||
|
}
|
||||||
|
|
||||||
if cascadeStop {
|
if cascadeStop {
|
||||||
if !aborting {
|
if !aborting {
|
||||||
aborting = true
|
aborting = true
|
||||||
|
@ -127,8 +127,10 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
|||||||
|
|
||||||
if options.Start.Watch {
|
if options.Start.Watch {
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
|
buildOpts := *options.Create.Build
|
||||||
|
buildOpts.Quiet = true
|
||||||
return s.Watch(ctx, project, options.Start.Services, api.WatchOptions{
|
return s.Watch(ctx, project, options.Start.Services, api.WatchOptions{
|
||||||
Build: options.Create.Build,
|
Build: &buildOpts,
|
||||||
LogTo: options.Start.Attach,
|
LogTo: options.Start.Attach,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -445,7 +445,6 @@ func (s *composeService) handleWatchBatch(ctx context.Context, project *types.Pr
|
|||||||
options.LogTo.Log(api.WatchLogger, fmt.Sprintf("Rebuilding service %q after changes were detected...", serviceName))
|
options.LogTo.Log(api.WatchLogger, fmt.Sprintf("Rebuilding service %q after changes were detected...", serviceName))
|
||||||
// restrict the build to ONLY this service, not any of its dependencies
|
// restrict the build to ONLY this service, not any of its dependencies
|
||||||
options.Build.Services = []string{serviceName}
|
options.Build.Services = []string{serviceName}
|
||||||
options.Build.Quiet = true
|
|
||||||
_, err := s.build(ctx, project, *options.Build, nil)
|
_, err := s.build(ctx, project, *options.Build, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
options.LogTo.Log(api.WatchLogger, fmt.Sprintf("Build failed. Error: %v", err))
|
options.LogTo.Log(api.WatchLogger, fmt.Sprintf("Build failed. Error: %v", err))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user