diff options
Diffstat (limited to 'src/runtime/testdata')
| -rw-r--r-- | src/runtime/testdata/testprog/signal_bogus.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprog/signal_bogus.go b/src/runtime/testdata/testprog/signal_bogus.go new file mode 100644 index 0000000000..a372277d41 --- /dev/null +++ b/src/runtime/testdata/testprog/signal_bogus.go @@ -0,0 +1,29 @@ +// Copyright 2026 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !plan9 + +package main + +import ( + "os" + "os/signal" + "syscall" +) + +func init() { + register("SignalBogus", SignalBogus) +} + +// signal.Notify should effectively ignore bogus signal numbers. Never writing +// to the channel, but otherwise allowing Notify/Stop as normal. +// +// This is a regression test for https://go.dev/issue/77076, where bogus +// signals used to make Stop hang if there were no real signals installed. +func SignalBogus() { + ch := make(chan os.Signal, 1) + signal.Notify(ch, syscall.Signal(0xdead)) + signal.Stop(ch) + println("OK") +} |
