mirror of https://github.com/docker/cli.git
Merge pull request #4262 from thaJeztah/no_lookpath
cli/config/credentials: skip unneeded exec.LookPath()
This commit is contained in:
commit
761d973656
|
@ -5,17 +5,20 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// DetectDefaultStore return the default credentials store for the platform if
|
// DetectDefaultStore return the default credentials store for the platform if
|
||||||
// the store executable is available.
|
// no user-defined store is passed, and the store executable is available.
|
||||||
func DetectDefaultStore(store string) string {
|
func DetectDefaultStore(store string) string {
|
||||||
platformDefault := defaultCredentialsStore()
|
if store != "" {
|
||||||
|
// use user-defined
|
||||||
// user defined or no default for platform
|
|
||||||
if store != "" || platformDefault == "" {
|
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err == nil {
|
platformDefault := defaultCredentialsStore()
|
||||||
return platformDefault
|
if platformDefault == "" {
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
return ""
|
|
||||||
|
if _, err := exec.LookPath(remoteCredentialsPrefix + platformDefault); err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return platformDefault
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue