Skip to content

Commit

Permalink
windows/debug/svc: buffer channel passed to signal.Notify
Browse files Browse the repository at this point in the history
The os/signal package drops signal notifications if the channel is not
ready to receive immediately. To avoid dropping signals (for example,
while processing the other branch of a 'select'), the channel must be
buffered.

This fixes a mistake flagged by 'go vet ./...'.

Change-Id: I2a20dbe2aa27ae8ec009fff5e7be47e4409fdddd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/465595
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
Bryan C. Mills authored and gopherbot committed Feb 6, 2023
1 parent 0e1262c commit 68f9dcb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion windows/svc/debug/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Run(name string, handler svc.Handler) error {
cmds := make(chan svc.ChangeRequest)
changes := make(chan svc.Status)

sig := make(chan os.Signal)
sig := make(chan os.Signal, 1)
signal.Notify(sig)

go func() {
Expand Down

0 comments on commit 68f9dcb

Please sign in to comment.