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

Skip calling Windows console api with piped stdin #51

Closed Heliozoa closed 4 years ago

Heliozoa commented 4 years ago

Fixes #50

I implemented the changes discussed in the issue. I also wrote a test that fails on Windows in the current master branch and passes after the changes, but it feels a bit hacky as it just runs one of the examples...

Heliozoa commented 4 years ago

Looks like the 1.33.0 version of rustc used by appveyor doesn't understand the temporary borrow in the test. Adding braces around it like so

{
    let stdin = out.stdin.as_mut().unwrap();
    stdin.write_all("secret".as_bytes()).unwrap();
}

or upgrading the appveyor version to 1.44.0 (or whenever this was fixed) should fix it.

conradkleinespel commented 4 years ago

@Heliozoa Feel free to upgrade Rust version to 1.44 in appveyor & travis configs, that'll make things easier. If people want to upgrade, they'll just have to use 1.44 too.

equalsraf commented 4 years ago

:+1 on my end, and nice going on the test.

conradkleinespel commented 4 years ago

Awesome, thank you both! I'll go ahead and merge. Then I'll publish to crates.io. Because users need to potentially upgrade their version of Rust, it is a "breaking" change so it'll be a major version increase.

conradkleinespel commented 4 years ago

Just saw that there is another PR I need to merge before publishing to avoid multiple major version increases. I'll get around to doing this the coming weekend.

Until then, I encourage you to use the git way of defining the dependency:

[dependencies]
rpassword = { git = "https://github.com/conradkleinespel/rpassword", rev = "189c388" }