1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00

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

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
Masaya Watanabe 2021-10-09 10:14:25 +09:00 committed by GitHub
parent 01ebbd8c2d
commit 7913d6db95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

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)