Cleanup from rige's review

This commit is contained in:
Ethan Frey 2018-02-26 13:44:27 +01:00 committed by rigelrozanski
parent 1c0fdfe660
commit 05f5141734
2 changed files with 7 additions and 1 deletions

View File

@ -71,10 +71,16 @@ func GetCheckPassword(prompt, prompt2 string) (string, error) {
return pass, nil return pass, nil
} }
// inputIsTty returns true iff we have an interactive prompt,
// where we can disable echo and request to repeat the password.
// If false, we can optimize for piped input from another command
func inputIsTty() bool { func inputIsTty() bool {
return isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd()) return isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd())
} }
// stdinPassword reads one line from stdin.
// Subsequent calls reuse the same buffer, so we don't lose
// any input when reading a password twice (to verify)
func stdinPassword() (string, error) { func stdinPassword() (string, error) {
if buf == nil { if buf == nil {
buf = bufio.NewReader(os.Stdin) buf = bufio.NewReader(os.Stdin)

View File

@ -60,7 +60,7 @@ func sendTx(cmd *cobra.Command, args []string) error {
result.CheckTx.Log) result.CheckTx.Log)
} }
if result.DeliverTx.Code != uint32(0) { if result.DeliverTx.Code != uint32(0) {
return errors.Errorf("CheckTx failed: (%d) %s", return errors.Errorf("DeliverTx failed: (%d) %s",
result.DeliverTx.Code, result.DeliverTx.Code,
result.DeliverTx.Log) result.DeliverTx.Log)
} }