[erlang-questions] Arguments to emulator in escript

Farruco Sanjurjo madtrick@REDACTED
Wed May 2 17:50:04 CEST 2012


Hi,

There's something with the options passed to the emulator within an escript
file that I don't get to work properly. The problem is:

If I add paths which contains glob expressions to the code path with -pa
argument in the escript file, this paths don't get added. Example:

#!/usr/bin/env escript
%%! -pa ebin deps/*/ebin

%
% Escript file to exemplify my problem
%

main(_) ->
  lists:foreach(fun(E) ->
        io:format("Path ~s ~n", [E])
    end, code:get_path()).

When I execute this escript, this is the output:

[madtrick@REDACTED { auth } (mock_auth_service *%) ruby-1.9.2-p290 ]
>> ./ecript
Path ebin
Path .
Path /usr/lib/erlang/lib/kernel-2.15/ebin
Path /usr/lib/erlang/lib/stdlib-1.18/ebin
Path /usr/lib/erlang/lib/xmerl-1.3/ebin
Path /usr/lib/erlang/lib/wx-0.99.1/ebin
Path /usr/lib/erlang/lib/webtool-0.8.9.1/ebin
Path /usr/lib/erlang/lib/typer-0.9.3/ebin
Path /usr/lib/erlang/lib/tv-2.1.4.8/ebin
Path /usr/lib/erlang/lib/tools-2.6.6.6/ebin
... % output deleted

As you can see, the ebin/ paths under deps/ don't get added to the code
path.

But, If I execute the emulator directly and use the same arguments those
paths get added:

[madtrick@REDACTED { auth } (mock_auth_service *%) ruby-1.9.2-p290 ]
>>erl -pa ebin deps/*/ebin
Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.9  (abort with ^G)
1> lists:foreach(fun(E) -> io:format("Path ~s ~n", [E]) end,
code:get_path()).
Path deps/reloader/ebin
Path deps/rabbit_common/ebin
Path deps/proper/ebin
Path deps/piqi_src/ebin
Path deps/piqi/ebin
Path deps/meck/ebin
Path deps/jiffy/ebin
Path deps/hamcrest/ebin
Path deps/espec/ebin
Path deps/coello/ebin
Path deps/amqp_client/ebin
Path ebin
Path .
Path /usr/lib/erlang/lib/kernel-2.15/ebin
Path /usr/lib/erlang/lib/stdlib-1.18/ebin
Path /usr/lib/erlang/lib/xmerl-1.3/ebin
Path /usr/lib/erlang/lib/wx-0.99.1/ebin
Path /usr/lib/erlang/lib/webtool-0.8.9.1/ebin
Path /usr/lib/erlang/lib/typer-0.9.3/ebin
Path /usr/lib/erlang/lib/tv-2.1.4.8/ebin
... %output deleted

As you can see, the ebin/ paths under deps/ get added.

Any ideas?

Thanks. Farruco Sanjurjo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120502/25bb705d/attachment.htm>


More information about the erlang-questions mailing list