mirror of https://github.com/docker/compose.git
Merge pull request #1344 from gtardif/fix_display_up_detach
Stop displaying logs when user cancels compose up, to not mix with stop progress display
This commit is contained in:
commit
8ebbd6ea14
|
@ -266,4 +266,6 @@ const (
|
||||||
ContainerEventAttach
|
ContainerEventAttach
|
||||||
// ContainerEventExit is a ContainerEvent of type exit. ExitCode is set
|
// ContainerEventExit is a ContainerEvent of type exit. ExitCode is set
|
||||||
ContainerEventExit
|
ContainerEventExit
|
||||||
|
// UserCancel user cancelled compose up, we are stopping containers
|
||||||
|
UserCancel
|
||||||
)
|
)
|
||||||
|
|
|
@ -205,6 +205,9 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
|
||||||
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
|
||||||
go func() {
|
go func() {
|
||||||
<-signalChan
|
<-signalChan
|
||||||
|
queue <- compose.ContainerEvent{
|
||||||
|
Type: compose.UserCancel,
|
||||||
|
}
|
||||||
fmt.Println("Gracefully stopping...")
|
fmt.Println("Gracefully stopping...")
|
||||||
stopFunc() // nolint:errcheck
|
stopFunc() // nolint:errcheck
|
||||||
}()
|
}()
|
||||||
|
@ -332,6 +335,8 @@ func (p printer) run(ctx context.Context, cascadeStop bool, exitCodeFrom string,
|
||||||
for {
|
for {
|
||||||
event := <-p.queue
|
event := <-p.queue
|
||||||
switch event.Type {
|
switch event.Type {
|
||||||
|
case compose.UserCancel:
|
||||||
|
aborting = true
|
||||||
case compose.ContainerEventAttach:
|
case compose.ContainerEventAttach:
|
||||||
consumer.Register(event.Name, event.Source)
|
consumer.Register(event.Name, event.Source)
|
||||||
count++
|
count++
|
||||||
|
|
Loading…
Reference in New Issue