Fix channel buffer used with signal.Notify () ()

Co-authored-by: Masaya Watanabe <sfbgwm30@gmail.com>
This commit is contained in:
6543 2021-10-10 13:59:48 +02:00 committed by GitHub
parent 8368a17b06
commit 9c208c1ab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions
cmd/drone-agent
cncd/pipeline/pipeline/interrupt

View File

@ -26,7 +26,7 @@ func WithContext(ctx context.Context) context.Context {
func WithContextFunc(ctx context.Context, f func()) context.Context {
ctx, cancel := context.WithCancel(ctx)
go func() {
c := make(chan os.Signal)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(c)

View File

@ -20,7 +20,7 @@ func WithContext(ctx context.Context) context.Context {
func WithContextFunc(ctx context.Context, f func()) context.Context {
ctx, cancel := context.WithCancel(ctx)
go func() {
c := make(chan os.Signal)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
defer signal.Stop(c)