Update module github.com/containers/common to v0.53.0

Signed-off-by: Renovate Bot <bot@renovateapp.com>
This commit is contained in:
renovate[bot]
2023-05-04 19:20:46 +00:00
committed by GitHub
parent b83e9925ea
commit 9213943ec9
6 changed files with 37 additions and 19 deletions

View File

@@ -242,14 +242,19 @@ func replaceURLByHostPort(repository string) (string, error) {
// using the -u and -p flags. If the username prompt is left empty, the
// displayed userFromAuthFile will be used instead.
func getUserAndPass(opts *LoginOptions, password, userFromAuthFile string) (user, pass string, err error) {
reader := bufio.NewReader(opts.Stdin)
username := opts.Username
if username == "" {
if opts.Stdin == nil {
return "", "", fmt.Errorf("cannot prompt for username without stdin")
}
if userFromAuthFile != "" {
fmt.Fprintf(opts.Stdout, "Username (%s): ", userFromAuthFile)
} else {
fmt.Fprint(opts.Stdout, "Username: ")
}
reader := bufio.NewReader(opts.Stdin)
username, err = reader.ReadString('\n')
if err != nil {
return "", "", fmt.Errorf("reading username: %w", err)