From 49b52e80bb37e151f1d10488e5db2c765c5eea4f Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:18:49 +0100 Subject: [PATCH] cmd/docker: fix possible race between ctx channel and signal channel Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> --- cmd/docker/docker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/docker/docker.go b/cmd/docker/docker.go index 0d190cbe2ad5..ead393b7c51d 100644 --- a/cmd/docker/docker.go +++ b/cmd/docker/docker.go @@ -43,7 +43,7 @@ func notifyContext(ctx context.Context, signals ...os.Signal) (context.Context, ch := make(chan os.Signal, 1) signal.Notify(ch, signals...) - ctx, cancel := context.WithCancelCause(ctx) + ctxCause, cancel := context.WithCancelCause(ctx) go func() { select { @@ -57,7 +57,7 @@ func notifyContext(ctx context.Context, signals ...os.Signal) (context.Context, } }() - return ctx, func() { + return ctxCause, func() { signal.Stop(ch) cancel(nil) }