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"
"os"
"strings"
"syscall"
"github.com/pkg/errors"
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)
log.Info("Create a new validator account for eth2")
log.Info("Enter a password:")
bytePassword, err := terminal.ReadPassword(syscall.Stdin)
bytePassword, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
log.Fatalf("Could not read account password: %v", err)
}

View File

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