[erlang-questions] Hiding user input in escript

Bjorn Gustavsson <>
Fri Apr 24 14:53:49 CEST 2009


On Fri, Apr 24, 2009 at 12:40 PM, Michal Ptaszek
<> wrote:
>
> ----- "Bjorn Gustavsson" <> wrote:
>
>> On Fri, Apr 24, 2009 at 9:19 AM, Michal Ptaszek
>> <> wrote:
>> > Hello All,
>> >
>> > Is it possible to disable echo while reading the data
>> > from the stdin in escript?
>> >
>>
>> io:get_password/0
>>
>
> It seems it does not like me:
>
> cat pass.erl
> #!/usr/bin/env escript
>
> main(_) ->
>    io:format("Password: "),
>    A = io:get_password(),
>    io:format("A = ~p~n", [A]).
>
>
> ./pass.erl:
> Password: A = {error,{request,get_password}}
>
> When it is running inside the Erlang shell, works perfectly.
> What am I doing wrong?

Sorry, I only tested it inside an Erlang shell, not in escript.

The problem seems to be that escript uses the old shell, which
does not support any way to control the terminal.

We'll have a look at escript for the next release and see whether
it would be possible to have it run with the standard shell.

/Bjorn


>
> BR
> --
> Michal Ptaszek
> www.erlang-consulting.com
>



-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list