From fffabdc8873bfe51e4e0e53839e85a8455ad9b26 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 18 Jan 2021 10:43:04 -0800 Subject: [PATCH] internal/client: use given context so it can be cancelled While attempting to connect to a server, Ctrl-C was not working. This is because we were using `context.Background` rather than the passed in context when attempting to connect. I don't know why we did this, it looks like a simple mistake from dev. Verified that this makes Ctrl-C work properly for server connection. --- internal/client/project.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/client/project.go b/internal/client/project.go index 460bffaacfd..d6480d4dc33 100644 --- a/internal/client/project.go +++ b/internal/client/project.go @@ -58,7 +58,7 @@ func New(ctx context.Context, opts ...Option) (*Project, error) { // package or spinning up an in-process server. if client.client == nil { client.logger.Trace("no API client provided, initializing connection if possible") - conn, err := client.initServerClient(context.Background(), &cfg) + conn, err := client.initServerClient(ctx, &cfg) if err != nil { return nil, err }