From bfac0062926cfcf93aac36aaee3f80ad42299266 Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 2 May 2016 15:29:50 +0200 Subject: [PATCH] Flush password prompt --- parity/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parity/main.rs b/parity/main.rs index a01612c589e..185cf3cbdd5 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -207,6 +207,10 @@ fn execute_client(conf: Configuration) { wait_for_exit(panic_handler, rpc_server, webapp_server); } +fn flush_stdout() { + ::std::io::stdout().flush().ok().expect("stdout is flushable; qed"); +} + fn execute_account_cli(conf: Configuration) { use util::keys::store::SecretStore; use rpassword::read_password; @@ -214,8 +218,10 @@ fn execute_account_cli(conf: Configuration) { if conf.args.cmd_new { println!("Please note that password is NOT RECOVERABLE."); print!("Type password: "); + flush_stdout(); let password = read_password().unwrap(); print!("Repeat password: "); + flush_stdout(); let password_repeat = read_password().unwrap(); if password != password_repeat { println!("Passwords do not match!");