File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -143,17 +143,20 @@ impl CLIConverser {
143143impl Converser for CLIConverser {
144144 fn handle_normal_prompt ( & self , msg : & str ) -> PamResult < PamBuffer > {
145145 let ( mut tty, _guard) = self . open ( ) ?;
146- tty. prompt ( & format ! ( "[{}: input needed] {msg} " , self . name) ) ?;
147- Ok ( tty. read_input ( None , Hidden :: No ) ?)
146+ Ok ( tty. read_input (
147+ & format ! ( "[{}: input needed] {msg} " , self . name) ,
148+ None ,
149+ Hidden :: No ,
150+ ) ?)
148151 }
149152
150153 fn handle_hidden_prompt ( & self , msg : & str ) -> PamResult < PamBuffer > {
151154 let ( mut tty, _guard) = self . open ( ) ?;
152155 if self . bell && !self . use_stdin {
153156 tty. bell ( ) ?;
154157 }
155- tty. prompt ( msg) ?;
156158 tty. read_input (
159+ msg,
157160 self . password_timeout ,
158161 if self . password_feedback {
159162 Hidden :: WithFeedback ( ( ) )
Original file line number Diff line number Diff line change @@ -281,6 +281,7 @@ impl Terminal<'_> {
281281 /// Reads input with TTY echo and visual feedback set according to the `hidden` parameter.
282282 pub ( super ) fn read_input (
283283 & mut self ,
284+ prompt : & str ,
284285 timeout : Option < Duration > ,
285286 hidden : Hidden < ( ) > ,
286287 ) -> io:: Result < PamBuffer > {
@@ -300,11 +301,15 @@ impl Terminal<'_> {
300301
301302 match self {
302303 Terminal :: StdIE ( stdin, stdout) => {
304+ write_unbuffered ( stdout, prompt. as_bytes ( ) ) ?;
305+
303306 let hide_input = do_hide_input ( stdin. as_fd ( ) ) ?;
304307 let mut reader = TimeoutRead :: new ( stdin. as_fd ( ) , timeout) ;
305308 read_unbuffered ( & mut reader, stdout, hide_input. as_ref ( ) )
306309 }
307310 Terminal :: Tty ( file) => {
311+ write_unbuffered ( file, prompt. as_bytes ( ) ) ?;
312+
308313 let hide_input = do_hide_input ( file. as_fd ( ) ) ?;
309314 let mut reader = TimeoutRead :: new ( file. as_fd ( ) , timeout) ;
310315 read_unbuffered ( & mut reader, & mut & * file, hide_input. as_ref ( ) )
You can’t perform that action at this time.
0 commit comments