Print password prompt on stderr.

This commit is contained in:
Paul Lietar 2017-01-05 14:24:22 +01:00
parent 9a8957169f
commit d0a84d7915

View file

@ -1,6 +1,6 @@
use getopts; use getopts;
use rpassword; use rpassword;
use std::io::{stdout, Write}; use std::io::{stderr, Write};
use std::path::PathBuf; use std::path::PathBuf;
use std::process::exit; use std::process::exit;
@ -107,8 +107,8 @@ pub fn get_credentials(session: &Session, matches: &getopts::Matches) -> Credent
=> credentials.clone(), => credentials.clone(),
(Some(username), None, _) => { (Some(username), None, _) => {
print!("Password for {}: ", username); write!(stderr(), "Password for {}: ", username).unwrap();
stdout().flush().unwrap(); stderr().flush().unwrap();
let password = rpassword::read_password().unwrap(); let password = rpassword::read_password().unwrap();
Credentials::with_password(username.clone(), password) Credentials::with_password(username.clone(), password)
} }