conradkleinespel / rpassword

Cross platform Rust library to read a password in the terminal (Linux, BSD, OSX, Windows, WASM).
Apache License 2.0
244 stars 38 forks source link

HiddenInput::new() calls tcgetattr twice #95

Open abacabadabacaba opened 7 months ago

abacabadabacaba commented 7 months ago

Here: https://github.com/conradkleinespel/rpassword/blob/49e3f3a3b25514b78375e97ad8d663ea7e35ad1c/src/lib.rs#L76-L77 This makes an extra syscall, even though the value can be just Copyed.

conradkleinespel commented 7 months ago

Indeed, you're right, thanks for pointing it out! :+1:

Feel free to provide a pull request with a fix. I don't have time to work on this at the moment.