Skip to content

Commit

Permalink
Fix a bug where the newline was not added when io error on reader-rea…
Browse files Browse the repository at this point in the history
…dline() occured
  • Loading branch information
NovaliX-Dev authored and conradkleinespel committed Jul 12, 2022
1 parent 309c876 commit 3858917
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rpassword/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ mod windows {

let hidden_input = HiddenInput::new(handle)?;

reader.read_line(&mut password)?;
let reader_return = reader.read_line(&mut password);

// Newline for windows which otherwise prints on the same line.
println!();

if reader_return.is_err() {
return Err(reader_return.unwrap_err());
}

std::mem::drop(hidden_input);

super::fix_new_line(password.into_inner())
Expand Down

0 comments on commit 3858917

Please sign in to comment.