fix: password read on windows

* fix: password read on windows

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek 2021-06-16 04:18:40 +02:00 committed by GitHub
parent a937c490b7
commit 84f896b329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import (
"fmt"
"os"
"strings"
"syscall"
"github.com/containers/image/v5/pkg/docker/config"
containersTypes "github.com/containers/image/v5/types"
@ -200,7 +201,7 @@ func getPassword(ctx context.Context) ([]byte, error) {
})
go func() {
pass, err := term.ReadPassword(0)
pass, err := term.ReadPassword(int(syscall.Stdin)) // nolint: unconvert
ch <- struct {
p []byte
e error
@ -232,7 +233,7 @@ func getUserName(ctx context.Context) (string, error) {
ch <- struct {
u string
e error
}{u: strings.TrimRight(username, "\n"), e: nil}
}{u: strings.TrimRight(username, "\r\n"), e: nil}
}()
select {