5

After creating an escript app:

$ rebar3 new escript hello

Can I run with with rebar3, instead of calling escriptize first?

I.e. something like this?

$ rebar3 run
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
  • I don't think there is any way to do this currently. Even the generated `README.md` says you have to run `_build/default/bin/script_name` after `rebar3 escriptize`. – Dogbert Jul 10 '16 at 11:02

1 Answers1

3

One solution might be to add a "run" directive to your makefile instead - this way you can call make run which does the escriptize step and runs the result.

Depending on what you really want to achieve running ./rebar3 shell might help you - I do this sometimes so I can debug portions of code just by running the required functions.

Finally you could always write a rebar plugin that extends the escriptize step ;) - never done it myself for rebar3 but has to be easier than the old rebar...

  • Thanks. Yes, `escriptize` wouldn't be the same, I was thinking something that does the equivalent to running a shell and then calling main immediately. – Andriy Drozdyuk Jul 11 '16 at 14:25
  • There is a pre-existing rebar3 plugin that does sort of what you ask, shouldn't take much to modify it to work with escripts: https://github.com/tsloughter/rebar3_run – Howard Beard-Marlowe Jul 11 '16 at 17:20