Read a line of password input with echo character support.
(self, input)
| 382 | return False |
| 383 | |
| 384 | def readline(self, input): |
| 385 | """Read a line of password input with echo character support.""" |
| 386 | while True: |
| 387 | assert self.cursor_pos >= 0 |
| 388 | char = input.read(1) |
| 389 | if self.is_eol(char): |
| 390 | break |
| 391 | # Handle literal next mode first as Ctrl+V quotes characters. |
| 392 | elif self.literal_next: |
| 393 | self.insert_char(char) |
| 394 | self.literal_next = False |
| 395 | # Handle EOF now as Ctrl+D must be pressed twice |
| 396 | # consecutively to stop reading from the input. |
| 397 | elif self.is_eof(char): |
| 398 | if self.eof_pressed: |
| 399 | break |
| 400 | elif self.handle(char): |
| 401 | # Dispatched to handler. |
| 402 | pass |
| 403 | else: |
| 404 | # Insert as normal character. |
| 405 | self.insert_char(char) |
| 406 | |
| 407 | self.eof_pressed = self.is_eof(char) |
| 408 | |
| 409 | return ''.join(self.password) |
| 410 | |
| 411 | |
| 412 | def getuser(): |