diff --git a/internal/codespaces/grpc/client.go b/internal/codespaces/grpc/client.go index 860893f68..5bfa179ba 100644 --- a/internal/codespaces/grpc/client.go +++ b/internal/codespaces/grpc/client.go @@ -89,8 +89,8 @@ func (g *Client) appendMetadata(ctx context.Context) context.Context { } // Starts a remote JupyterLab server to allow the user to connect to the codespace via JupyterLab in their browser -func (g *Client) StartJupyterServer() (port int, serverUrl string, err error) { - ctx, cancel := context.WithTimeout(context.Background(), requestTimeout) +func (g *Client) StartJupyterServer(ctx context.Context) (port int, serverUrl string, err error) { + ctx, cancel := context.WithTimeout(ctx, requestTimeout) ctx = g.appendMetadata(ctx) defer cancel() diff --git a/pkg/cmd/codespace/jupyter.go b/pkg/cmd/codespace/jupyter.go index b5ce34a9f..bc1d6d2fe 100644 --- a/pkg/cmd/codespace/jupyter.go +++ b/pkg/cmd/codespace/jupyter.go @@ -51,7 +51,7 @@ func (a *App) Jupyter(ctx context.Context, codespaceName string) (err error) { defer safeClose(client, &err) a.StartProgressIndicatorWithLabel("Starting JupyterLab on codespace") - serverPort, serverUrl, err := client.StartJupyterServer() + serverPort, serverUrl, err := client.StartJupyterServer(ctx) a.StopProgressIndicator() if err != nil { return fmt.Errorf("failed to start JupyterLab server: %w", err)