File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -271,15 +271,20 @@ impl Terminal<'_> {
271271 pub fn read_password ( & mut self , timeout : Option < Duration > ) -> io:: Result < PamBuffer > {
272272 let mut input = self . source_timeout ( timeout) ;
273273 let _hide_input = HiddenInput :: new ( false ) ?;
274- read_unbuffered ( & mut input)
274+ let ret = read_unbuffered ( & mut input) ;
275+ if ret. is_err ( ) {
276+ let _ = self . sink ( ) . write ( b"\n " ) ;
277+ }
278+
279+ ret
275280 }
276281
277282 /// Reads input with TTY echo disabled, but do provide visual feedback while typing.
278283 pub fn read_password_with_feedback (
279284 & mut self ,
280285 timeout : Option < Duration > ,
281286 ) -> io:: Result < PamBuffer > {
282- if let Some ( hide_input) = HiddenInput :: new ( true ) ? {
287+ let ret = if let Some ( hide_input) = HiddenInput :: new ( true ) ? {
283288 match self {
284289 Terminal :: StdIE ( stdin, stdout) => {
285290 let mut reader = TimeoutRead :: new ( stdin. as_fd ( ) , timeout) ;
@@ -292,7 +297,13 @@ impl Terminal<'_> {
292297 }
293298 } else {
294299 read_unbuffered ( & mut self . source_timeout ( timeout) )
300+ } ;
301+
302+ if ret. is_err ( ) {
303+ let _ = self . sink ( ) . write ( b"\n " ) ;
295304 }
305+
306+ ret
296307 }
297308
298309 /// Reads input with TTY echo enabled
You can’t perform that action at this time.
0 commit comments