Skip to content

Commit

Permalink
Merge pull request #982 from tiborvass/fix-stdin-blocking
Browse files Browse the repository at this point in the history
session: add lock to fix hang
  • Loading branch information
tonistiigi committed May 8, 2019
2 parents bec5b3e + f467c29 commit 97b4b9a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions session/auth/authprovider/authprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package authprovider
import (
"context"
"io/ioutil"
"sync"

"github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/configfile"
Expand All @@ -19,13 +20,21 @@ func NewDockerAuthProvider() session.Attachable {

type authProvider struct {
config *configfile.ConfigFile

// The need for this mutex is not well understood.
// Without it, the docker cli on OS X hangs when
// reading credentials from docker-credential-osxkeychain.
// See issue https://github.com/docker/cli/issues/1862
mu sync.Mutex
}

func (ap *authProvider) Register(server *grpc.Server) {
auth.RegisterAuthServer(server, ap)
}

func (ap *authProvider) Credentials(ctx context.Context, req *auth.CredentialsRequest) (*auth.CredentialsResponse, error) {
ap.mu.Lock()
defer ap.mu.Unlock()
if req.Host == "registry-1.docker.io" {
req.Host = "https://index.docker.io/v1/"
}
Expand Down

0 comments on commit 97b4b9a

Please sign in to comment.