|
|
@ -116,15 +116,11 @@ func (a *App) Run() error { |
|
|
|
c := make(chan os.Signal, 1) |
|
|
|
c := make(chan os.Signal, 1) |
|
|
|
signal.Notify(c, a.opts.sigs...) |
|
|
|
signal.Notify(c, a.opts.sigs...) |
|
|
|
eg.Go(func() error { |
|
|
|
eg.Go(func() error { |
|
|
|
for { |
|
|
|
select { |
|
|
|
select { |
|
|
|
case <-ctx.Done(): |
|
|
|
case <-ctx.Done(): |
|
|
|
return nil |
|
|
|
return ctx.Err() |
|
|
|
case <-c: |
|
|
|
case <-c: |
|
|
|
return a.Stop() |
|
|
|
if err := a.Stop(); err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
if err := eg.Wait(); err != nil && !errors.Is(err, context.Canceled) { |
|
|
|
if err := eg.Wait(); err != nil && !errors.Is(err, context.Canceled) { |
|
|
|