[erlang-questions] what's happened in the shootout

Ulf Wiger (TN/EAB) <>
Mon Jun 18 20:51:19 CEST 2007


I wrote:
>
> BTW, I noticed that many tests in the shootout have command 
> lines that look like this:
> 
>  /usr/local/bin/erl -noinput -noshell -run nbody main %A
> 
> It's not obvious from the documentation, but the flags 
> -nouser, -noinput, 

Gahh, emacs fingers in Outlook again!

It's not obvious from the documentation, but the flags 

 -nouser, -noinput, -user U, -noshell, -oldshell -master Node

all override each other such that only the last one on the 
command line is considered.

Here's the relevant code in user_sup.erl:

get_user() ->
    Flags = init:get_arguments(),
    check_flags(Flags, {user_drv, start, []}).

check_flags([{nouser, []} |T], _) -> check_flags(T, nouser);
check_flags([{user, [User]} | T], _) ->
    check_flags(T, {list_to_atom(User), start, []});
check_flags([{noshell, []} | T], _) -> check_flags(T, {user, start,
[]});
check_flags([{oldshell, []} | T], _) -> check_flags(T, {user, start,
[]});
check_flags([{noinput, []} | T], _) -> check_flags(T, {user, start_out,
[]});
check_flags([{master, [Node]} | T], _) ->
    check_flags(T, {master, list_to_atom(Node)});
check_flags([_H | T], User) -> check_flags(T, User);
check_flags([], User) -> User.


BR,
Ulf W



More information about the erlang-questions mailing list