From 1ba95c3d37d65e118ba0fc77985fbbb68fea60b1 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 3 May 2023 03:03:06 +0200 Subject: [PATCH] fix(run.go): use a non-blocking channel receive adding the started channel and receiving in a blocking fashion meant the program flow never got to blocking on the quit channel after setting up signal intercepts. this commit turns the blocking receive on `started` to a non-blocking one. --- run.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run.go b/run.go index 6093c78..7e14efe 100644 --- a/run.go +++ b/run.go @@ -169,9 +169,14 @@ func run() error { started <- err }(started) - err = <-started - if err != nil { - return err + // non-blocking channel receive. + select { + case err := <-started: + if err != nil { + return err + } + + default: } quit := make(chan os.Signal, 1)