diff options
author | Wolfy-J <[email protected]> | 2018-06-24 17:02:04 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-24 17:02:04 +0300 |
commit | 248011fd85beff9a03ffbec946860de55afb0cae (patch) | |
tree | b854a0bb2f8f2c0ab3c47b0edfa111f1a4c3691a | |
parent | 9e39b07d4c41c8a565c139837aa4c405c4c9f5a8 (diff) |
better server stop
-rw-r--r-- | cmd/rr/cmd/serve.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/cmd/rr/cmd/serve.go b/cmd/rr/cmd/serve.go index 664baf15..8028395a 100644 --- a/cmd/rr/cmd/serve.go +++ b/cmd/rr/cmd/serve.go @@ -33,20 +33,17 @@ func init() { CLI.AddCommand(&cobra.Command{ Use: "serve", Short: "Serve RoadRunner service(s)", - RunE: serveHandler, + Run: serveHandler, }) signal.Notify(stopSignal, os.Interrupt, os.Kill, syscall.SIGTERM) } -func serveHandler(cmd *cobra.Command, args []string) error { +func serveHandler(cmd *cobra.Command, args []string) { go func() { - Container.Serve() - stopSignal <- nil + <-stopSignal + Container.Stop() }() - <-stopSignal - Container.Stop() - - return nil + Container.Serve() } |