Change summary
cmd/soft/serve/serve.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Detailed changes
@@ -82,10 +82,11 @@ var (
}
}
+ lch := make(chan error, 1)
done := make(chan os.Signal, 1)
doneOnce := sync.OnceFunc(func() { close(done) })
- lch := make(chan error, 1)
+ signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
// This endpoint is added for testing purposes
// It allows us to stop the server from the test suite.
@@ -102,11 +103,10 @@ var (
}
go func() {
- defer doneOnce()
lch <- s.Start()
+ doneOnce()
}()
- signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
<-done
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)