Closed longshorej closed 5 years ago
@longshorej Would you mind trying out the latest version on the master
branch (not yet published on crates.io) with the new read_password_from_tty
function ?
You can find an example for how to add a Git repo as a dependency here: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-git-repositories
Basically:
[dependencies]
rand = { git = "https://github.com/rust-lang-nursery/rand" }
Sorry for the slow response @conradkdotcom. To confirm, yes, this happens on master
.
@longshorej Hmm, OK. As far as I know, not every version of Windows comes bundled with bash, right ? If this is correct, how could we fix this so that it works both with Windows without Bash and Windows with Bash ? Else, I'm totally fine with just using that you've suggested here. Basically, as long as stuff works for everyone, let's do it ! :+1:
Hello @longshorej ! Are you still interested in getting this fixed ? Otherwise, I'll have to close this issue, as unfortunately, I don't have time to invest in Windows support for this.
I'll close it - the workaround above has us moving forward. I don't think that should belong in library code though, better to keep the hacks in the applications :smile:
Hi! Thanks for rpassword! Currently using it in a cross-platform CLI application.
When on Windows, using cmd or Powershell, all is well. Similarly, macOS and GNU/Linux with bash work fine.
When running on Windows via bash, e.g. Git Bash, calls to
read_password_from_stdin
fail because there's no Windows console available.I've used the following really hacky workaround, but I'm curious if you have any ideas for a better solution. I did try enabling the Unix module when compiling rpassword on Windows, but libc for Windows naturally doesn't implement many of the required functions or constants, e.g.
tcsetattr
, so it fails to compile.Here's the hack which spawns bash to read the password, for anyone else that may be stuck on this issue: