[erlang-questions] Arguments to emulator in escript

Sergei Golovan sgolovan@REDACTED
Wed May 2 18:00:10 CEST 2012


On Wed, May 2, 2012 at 7:50 PM, Farruco Sanjurjo <madtrick@REDACTED> wrote:
> 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

The argument -pa ebin deps/*/ebin is subject to shell globbing if it's
supplied to the erl command in bash/zsh whatever. So, Erlang VM sees
-pa ebin deps/amqp_client/ebin ... deps/reloader/ebin
and processes the entire list of directories.

In escript -pa ebin deps/*/ebin goes to Erlang VM literally, and since
there's no deps/*/ebin directory, it isn't appended to the code path
at all.

I don't know which is the best way of adding these directories to the
code path. I'd use code:add_pathsa/1 directly in main/1.

Cheers!
-- 
Sergei Golovan



More information about the erlang-questions mailing list