Zulip Chat Archive
Stream: Is there code for X?
Topic: password input
Asei Inoue (Jan 20 2025 at 11:32):
I wrote the following function to accept input from the keyboard:
def IO.getInputln : IO String := do
(← IO.getStdin).getLine
This function works, but I have a question.
When prompting for a password, the entered string is usually not displayed in the terminal. However, if I use the getInputln
function above, the entered string is displayed. How can I control what is displayed in the terminal, regardless of the entered string?
Julian Berman (Jan 20 2025 at 11:50):
It's OS specific of course. On *nix/ in POSIX you flip the echo termios bit, see e.g.: https://github.com/python/cpython/blob/3.13/Lib/getpass.py#L68
Last updated: May 02 2025 at 03:31 UTC