From 72f81fe1d46ab43e24e9a5c23c5ca54bfe6d701d Mon Sep 17 00:00:00 2001 From: Wolfy-J Date: Mon, 11 Jun 2018 12:38:39 +0300 Subject: no more updated --- cmd/rr/http/workers.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cmd/rr/http') diff --git a/cmd/rr/http/workers.go b/cmd/rr/http/workers.go index 394874fa..d04e37fb 100644 --- a/cmd/rr/http/workers.go +++ b/cmd/rr/http/workers.go @@ -36,6 +36,8 @@ import ( "os" "strconv" "time" + "os/signal" + "syscall" ) var ( @@ -59,6 +61,9 @@ func init() { ) rr.CLI.AddCommand(workersCommand) + + signal.Notify(stopSignal, syscall.SIGTERM) + signal.Notify(stopSignal, syscall.SIGINT) } func workersHandler(cmd *cobra.Command, args []string) (err error) { @@ -87,6 +92,8 @@ func workersHandler(cmd *cobra.Command, args []string) (err error) { tm.Clear() for { select { + case <-stopSignal: + return nil case <-time.NewTicker(time.Millisecond * 500).C: tm.MoveCursor(1, 1) showWorkers(client) @@ -94,7 +101,6 @@ func workersHandler(cmd *cobra.Command, args []string) (err error) { } } - <-stopSignal return nil } -- cgit v1.2.3