diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-08-20 16:40:43 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-08-20 17:19:09 +0300 |
commit | e6e4ecedaa7b1879e6debdec8299bdca7efb8dd7 (patch) | |
tree | 24fb490f155e85f11f007e769f91fbe49efc1d89 /cmd | |
parent | 48d7984d9912c935a2c2abba3b55593cf0be2d8e (diff) |
praefect: Fix misuse of `signal.Notify()` with unbuffered channel
The documentation of `signal.Notify()` mentions that the caller must
ensure that the provided channel is sufficiently buffered, but we pass
in an unbuffered channel. Let's fix this by creating the channel with a
buffer size of "1" such that we can receive at least one signal.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/praefect/subcmd.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/praefect/subcmd.go b/cmd/praefect/subcmd.go index dee97f487..17bd17b8d 100644 --- a/cmd/praefect/subcmd.go +++ b/cmd/praefect/subcmd.go @@ -38,7 +38,7 @@ var ( // subCommand returns an exit code, to be fed into os.Exit. func subCommand(conf config.Config, arg0 string, argRest []string) int { - interrupt := make(chan os.Signal) + interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, os.Interrupt) go func() { |