From 95b7a3d3ce81a51b476efd2f17d1c0011db82c95 Mon Sep 17 00:00:00 2001 From: #Suyghur Date: Sun, 15 Oct 2023 09:58:15 -0500 Subject: [PATCH] feat: add the SIGINT signal in signals.go to subscribe the user input ctrl+c to exit the application operation (#3611) --- core/proc/signals.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/proc/signals.go b/core/proc/signals.go index 2f9af2d1..a6d667d2 100644 --- a/core/proc/signals.go +++ b/core/proc/signals.go @@ -20,7 +20,7 @@ func init() { // https://golang.org/pkg/os/signal/#Notify signals := make(chan os.Signal, 1) - signal.Notify(signals, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGTERM) + signal.Notify(signals, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGTERM, syscall.SIGINT) for { v := <-signals @@ -34,14 +34,13 @@ func init() { profiler.Stop() profiler = nil } - case syscall.SIGTERM: + case syscall.SIGTERM, syscall.SIGINT: select { case <-done: // already closed default: close(done) } - gracefulStop(signals) default: logx.Error("Got unregistered signal:", v)