Windows friendly stdin reads for passwords (#5010)

* cast os.stdin filehandle since on windows syscall.Stdin is not int
* import ordering
* Merge branch 'master' into prysm-5008-windows-stdin-not-int
This commit is contained in:
prylabs-bulldozer[bot] 2020-03-05 07:31:11 +00:00 committed by GitHub
parent e635e5b205
commit 5961aaf588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -7,7 +7,6 @@ import (
"io" "io"
"os" "os"
"strings" "strings"
"syscall"
"github.com/pkg/errors" "github.com/pkg/errors"
contract "github.com/prysmaticlabs/prysm/contracts/deposit-contract" contract "github.com/prysmaticlabs/prysm/contracts/deposit-contract"
@ -136,7 +135,7 @@ func CreateValidatorAccount(path string, passphrase string) (string, string, err
reader := bufio.NewReader(os.Stdin) reader := bufio.NewReader(os.Stdin)
log.Info("Create a new validator account for eth2") log.Info("Create a new validator account for eth2")
log.Info("Enter a password:") log.Info("Enter a password:")
bytePassword, err := terminal.ReadPassword(syscall.Stdin) bytePassword, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil { if err != nil {
log.Fatalf("Could not read account password: %v", err) log.Fatalf("Could not read account password: %v", err)
} }

View File

@ -7,7 +7,6 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
"syscall"
"github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/bytesutil"
@ -63,7 +62,7 @@ func NewKeystore(input string) (KeyManager, string, error) {
} else { } else {
if opts.Passphrase == "" { if opts.Passphrase == "" {
log.Info("Enter your validator account password:") log.Info("Enter your validator account password:")
bytePassword, err := terminal.ReadPassword(syscall.Stdin) bytePassword, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil { if err != nil {
return nil, keystoreOptsHelp, err return nil, keystoreOptsHelp, err
} }