diff --git a/parity/main.rs b/parity/main.rs index e9fd24c01..e9833fd38 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -39,6 +39,7 @@ extern crate rpassword; #[cfg(feature = "rpc")] extern crate ethcore_rpc as rpc; +use std::io::{BufRead, BufReader}; use std::fs::File; use std::net::{SocketAddr, IpAddr}; use std::env; @@ -500,11 +501,13 @@ impl Configuration { fn account_service(&self) -> AccountService { // Secret Store - let passwords = self.args.flag_password.iter().map(|filename| { - let mut buffer = String::new(); - File::open(filename).and_then(|mut f| f.read_to_string(&mut buffer)).unwrap_or_else(|_| die!("{} Unable to read password file. Ensure it exists and permissions are correct.", filename)); - buffer - }).collect::>(); + let passwords = self.args.flag_password.iter().flat_map(|filename| { + BufReader::new(&File::open(filename).unwrap_or_else(|_| die!("{} Unable to read password file. Ensure it exists and permissions are correct.", filename))) + .lines() + .map(|l| l.unwrap()) + .collect::>() + .into_iter() + }).collect::>(); let account_service = AccountService::new(); for d in &self.args.flag_unlock {