mirror of https://github.com/docker/compose.git
`Event` is way too generic noon
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
27d640dd41
commit
06b033db6c
|
@ -68,7 +68,7 @@ type StartOptions struct {
|
||||||
// Attach will attach to container and pipe stdout/stderr to LogConsumer
|
// Attach will attach to container and pipe stdout/stderr to LogConsumer
|
||||||
Attach LogConsumer
|
Attach LogConsumer
|
||||||
// Listener will get notified on container events
|
// Listener will get notified on container events
|
||||||
Listener Listener
|
Listener chan ContainerExited
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpOptions group options of the Up API
|
// UpOptions group options of the Up API
|
||||||
|
@ -188,11 +188,8 @@ type LogConsumer interface {
|
||||||
Status(service, container, message string)
|
Status(service, container, message string)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listener get notified on container Events
|
// ContainerExited let us know a Container exited
|
||||||
type Listener chan Event
|
type ContainerExited struct {
|
||||||
|
|
||||||
// Event let us know a Container exited
|
|
||||||
type Event struct {
|
|
||||||
Service string
|
Service string
|
||||||
Status int
|
Status int
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
listener := make(chan compose.Event)
|
listener := make(chan compose.ContainerExited)
|
||||||
go func() {
|
go func() {
|
||||||
var aborting bool
|
var aborting bool
|
||||||
for {
|
for {
|
||||||
|
|
|
@ -64,7 +64,7 @@ func (s *composeService) Start(ctx context.Context, project *types.Project, opti
|
||||||
service := c.Labels[serviceLabel]
|
service := c.Labels[serviceLabel]
|
||||||
options.Attach.Status(service, getCanonicalContainerName(c), fmt.Sprintf("exited with code %d", status.StatusCode))
|
options.Attach.Status(service, getCanonicalContainerName(c), fmt.Sprintf("exited with code %d", status.StatusCode))
|
||||||
if options.Listener != nil {
|
if options.Listener != nil {
|
||||||
options.Listener <- compose.Event{
|
options.Listener <- compose.ContainerExited{
|
||||||
Service: service,
|
Service: service,
|
||||||
Status: int(status.StatusCode),
|
Status: int(status.StatusCode),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue