Hmm. I see what you mean now. Is this simply impossible to accomplish inside the VM without a fix from Erlang?
On Wednesday, July 15, 2020 at 12:18:36 AM UTC-7, José Valim wrote: > > Unfortunately the solution in Hex has some pitfalls, like it requires to > erase the current line, and potentially others. In my opinion it is not > general purpose enough to be included in stdlib. > > On Wed, Jul 15, 2020 at 7:26 AM Spencer Gilson <[email protected] > <javascript:>> wrote: > >> Prompting a user for a secret is not too uncommon, especially when >> building CLI applications. Due to an issue that has remained unresolved >> for many years >> <http://erlang.org/pipermail/erlang-questions/2014-July/080273.html>, >> :io.get_password() does not work when invoked in a Mix task or through >> escript. This is unfortunate as I would guess that these are the primary >> environments that users are likely to use that function. I believe that >> Elixir would benefit from a standard method that can accomplish this >> functionality both in normal operation and in the environments mentioned >> above. >> >> Hex currently has an implementation that appears to be stable >> <https://github.com/hexpm/hex/blob/28dbfb9ae51099d1fcb2ce91b94a1dab9216e5d8/lib/mix/tasks/hex.ex#L371>, >> >> and I believe it would suitable to adopt it as a utility method in >> Kernel.IO. Ideally, the behavior would wrap the Erlang library similar to >> how other functions in the module do, however, I feel the logic to >> compensate for the problem in :io would either require matching the error >> tuple: >> >> {:error, {:request, {:get_password, :unicode}}} >> >> or checking environment conditions to see if the Erlang method is likely >> to succeed, neither of which seem like a great solution. >> >> If there is any reason that the Hex implemenation is not suitable as a >> standard in the absence of support from :io, I'm really interested, >> especially if there are portability issues. >> >> In the mean time, I'll adopt the function into my own project with a >> reference to Hex :P >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/8724762b-428a-4aca-a4cf-bb9e0bed8e08o%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/8724762b-428a-4aca-a4cf-bb9e0bed8e08o%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/253b4a26-47dd-4d76-b130-e3147b9660e9o%40googlegroups.com.
