mirror of
https://github.com/gravitational/teleport
synced 2024-10-21 17:53:28 +00:00
Prefer signal.NotifyContext over the manual implementation
This commit is contained in:
parent
2396281028
commit
dc08501c5f
|
@ -722,15 +722,8 @@ func Run(args []string, opts ...cliOption) error {
|
|||
utils.InitLogger(utils.LoggingForCLI, logrus.DebugLevel)
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
go func() {
|
||||
exitSignals := make(chan os.Signal, 1)
|
||||
signal.Notify(exitSignals, syscall.SIGTERM, syscall.SIGINT)
|
||||
|
||||
sig := <-exitSignals
|
||||
log.Debugf("signal: %v", sig)
|
||||
cancel()
|
||||
}()
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT)
|
||||
defer cancel()
|
||||
cf.Context = ctx
|
||||
|
||||
cf.executablePath, err = os.Executable()
|
||||
|
|
Loading…
Reference in a new issue