Skip to content

Commit

Permalink
Deadline: limit shutdown to 5s max
Browse files Browse the repository at this point in the history
  • Loading branch information
cyx committed Jan 25, 2021
1 parent 99dcf18 commit 336dce4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/cli/try_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 336dce4

Please sign in to comment.