From 05f514173404159ba3c0c771250e3a15b3387873 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Mon, 26 Feb 2018 13:44:27 +0100 Subject: [PATCH] Cleanup from rige's review --- client/input.go | 6 ++++++ x/bank/commands/sendtx.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/input.go b/client/input.go index 8670f42bf2..db06f404ca 100644 --- a/client/input.go +++ b/client/input.go @@ -71,10 +71,16 @@ func GetCheckPassword(prompt, prompt2 string) (string, error) { 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 { 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) { if buf == nil { buf = bufio.NewReader(os.Stdin) diff --git a/x/bank/commands/sendtx.go b/x/bank/commands/sendtx.go index 1cdc77cb01..dc0a6bdd96 100644 --- a/x/bank/commands/sendtx.go +++ b/x/bank/commands/sendtx.go @@ -60,7 +60,7 @@ func sendTx(cmd *cobra.Command, args []string) error { result.CheckTx.Log) } 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.Log) }