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

Error on Windows 7 #83

Closed Berrysoft closed 1 year ago

Berrysoft commented 1 year ago

I have tested this crate on Windows 7. The following line causes the error: https://github.com/conradkleinespel/rpassword/blob/1af683038cd34cd9ffafe614af21f77ff6544e0e/src/lib.rs#L206

Suggested:

let mut stream = BufReader::new(std::io::stdin());

Anyway, you can ignore this issue if you don't want to maintain for the old, unmaintained Windows 7:)

conradkleinespel commented 1 year ago

Hello @Berrysoft, thanks for your report. I'm not sure your suggestion would work as expected because we knowingly use a handle, which we configure with these lines. But I don't use Windows a lot so I'm not sure. This project has few maintainers and our time is limited so you'll most likely have to find a fix and submit a PR with test case if you need this to work as expected.

Berrysoft commented 1 year ago

Yes, I understand the configuration. The code doesn't work on Windows 7 because CreateFileA returns a handle 0x3 or 0x1f in the console, and NtReadFile doesn't accept these handles.

It's painful to debug on Windows 7, and I just tested my project in the hypervisor for fun. I cannot be responsible for the change because I'm not able to test all possible cases of this crate. It's OK to ignore this issue.