From 336dce4edeaabf79dfbaa045afc6301385cbf9ef Mon Sep 17 00:00:00 2001 From: Cyril David Date: Mon, 25 Jan 2021 15:52:04 -0800 Subject: [PATCH] Deadline: limit shutdown to 5s max --- internal/cli/try_login.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/cli/try_login.go b/internal/cli/try_login.go index 3cd3b5dcb..3653275b8 100644 --- a/internal/cli/try_login.go +++ b/internal/cli/try_login.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "net/url" + "time" "github.com/auth0/auth0-cli/internal/auth" "github.com/auth0/auth0-cli/internal/open" @@ -194,7 +195,10 @@ func waitForBrowserCallback() (string, error) { select { case code := <-codeCh: - err := s.Shutdown(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + err := s.Shutdown(ctx) return code, err case err := <-errCh: return "", err