mirror of
https://github.com/docker/compose.git
synced 2025-07-23 13:45:00 +02:00
fix: return correct exit code with --exit-code-from
(#11715)
This commit is contained in:
parent
b3792dd258
commit
c9e070f0f6
@ -138,9 +138,11 @@ func (p *printer) Run(cascade api.Cascade, exitCodeFrom string, stopFn func() er
|
|||||||
if cascade == api.CascadeStop && exitCodeFrom == "" {
|
if cascade == api.CascadeStop && exitCodeFrom == "" {
|
||||||
exitCodeFrom = event.Service
|
exitCodeFrom = event.Service
|
||||||
}
|
}
|
||||||
if exitCodeFrom == event.Service {
|
}
|
||||||
exitCode = event.ExitCode
|
|
||||||
}
|
if exitCodeFrom == event.Service && (event.Type == api.ContainerEventExit || event.Type == api.ContainerEventStopped) {
|
||||||
|
// Container was interrupted or exited, let's capture exit code
|
||||||
|
exitCode = event.ExitCode
|
||||||
}
|
}
|
||||||
if len(containers) == 0 {
|
if len(containers) == 0 {
|
||||||
// Last container terminated, done
|
// Last container terminated, done
|
||||||
|
@ -268,6 +268,7 @@ func (s *composeService) watchContainers(ctx context.Context, //nolint:gocyclo
|
|||||||
Container: name,
|
Container: name,
|
||||||
ID: container.ID,
|
ID: container.ID,
|
||||||
Service: service,
|
Service: service,
|
||||||
|
ExitCode: inspected.State.ExitCode,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user