mirror of https://github.com/docker/compose.git
send out a cancel event on SIGINT/SIGTERM
Signed-off-by: vyneer <vyn33r@gmail.com>
This commit is contained in:
parent
9faef4aebb
commit
1f148244af
|
@ -64,6 +64,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
|||
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)
|
||||
defer close(signalChan)
|
||||
var isTerminated bool
|
||||
printer := newLogPrinter(options.Start.Attach)
|
||||
|
||||
doneCh := make(chan bool)
|
||||
eg.Go(func() error {
|
||||
|
@ -74,6 +75,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
|||
return nil
|
||||
case <-signalChan:
|
||||
if first {
|
||||
printer.Cancel()
|
||||
fmt.Fprintln(s.stdinfo(), "Gracefully stopping... (press Ctrl+C again to force)")
|
||||
eg.Go(func() error {
|
||||
err := s.Stop(context.Background(), project.Name, api.StopOptions{
|
||||
|
@ -98,8 +100,6 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
|||
}
|
||||
})
|
||||
|
||||
printer := newLogPrinter(options.Start.Attach)
|
||||
|
||||
var exitCode int
|
||||
eg.Go(func() error {
|
||||
code, err := printer.Run(options.Start.CascadeStop, options.Start.ExitCodeFrom, func() error {
|
||||
|
|
Loading…
Reference in New Issue