x/simulation: make signals channel buffered to avoid missing signals (#7952)

Invoking:

    c := make(chan os.Signal)
    signal.Notify(c, signals...)

is explicitly called out as a bug in the os/signal docs
and should instead make that channel buffered lest
a signal could be lost.

Fixes #7950

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
Emmanuel T Odeke 2020-11-17 06:27:12 -08:00 committed by GitHub
parent 0647d897f5
commit 9369a00557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,7 +102,7 @@ func SimulateFromSeed(
opCount := 0
// Setup code to catch SIGTERM's
c := make(chan os.Signal)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGINT)
go func() {