Questions tagged [erlang-escript]

escript provides support for running short Erlang programs without having to compile them first and an easy way to retrieve the command line arguments.

Escript Documentation: http://www.erlang.org/doc/man/escript.html

19 questions
7
votes
1 answer

Escript: setting code path relative to script directory

When I try to set a relative code path in a escript with -pz like this #!/usr/bin/env escript %% -*- erlang -*- %%! -pz ../dir-of-some-beams The path is interpreted relative to the directory from where I run the escript from, which renders it…
Peer Stritzinger
  • 8,232
  • 2
  • 30
  • 43
6
votes
1 answer

Why cannot escript run?

rebar is in the current directory. $ls -l rebar --rwxr-xr-x 1 *** wheel 90778 8 6 23:05 rebar* $./rebar escript: no such file or directory: './rebar' $whereis escript escript: /usr/local/bin/escript I am using FreeBSD 9.0. thanks!
z_axis
  • 8,272
  • 7
  • 41
  • 61
5
votes
4 answers

Best way to convert list of lists to list of tuples?

What's the best way to convert a list such as [[1,2,3],[a,b,c],[4,5,6]] to a list of tuples like this: [{1,a,4},{2,b,5},{3,c,6}] where tuple N is composed of the Nth element from each of the three sublists? Should I use a tail recursive function, a…
Vignesh Sivam
  • 75
  • 1
  • 8
4
votes
2 answers

How can I build an Elixir escript that does not halt the Erlang VM after execution (like elixir --no-halt)

I have a program that starts the application and then adds (children) workers to a supervisor. Obviously after doing only that it has nothing more left to do and it halts (exits). So making it not halt the VM would allow the workers to work. The…
Szymon Jeż
  • 8,273
  • 4
  • 42
  • 60
3
votes
2 answers

How does one start an Erlang OTP application and allow the passing of command-line arguments to the application's root supervisor?

Quick 1 liner: How does one start an OTP application and pass command-line args to it? I wanted be able to start an OTP application in a generic "UNIX" way, being able to pass command-line arguments parsed by getopts. So, I have an erlang escript…
Deven Phillips
  • 1,129
  • 14
  • 39
3
votes
1 answer

Erlang escript arguments

I don't really understand how command line arguments work with escripts. From the manpage, I understand that the arguments are passed as a list of strings to main/1. How can I parse the arguments passed to main? Consider the…
Dr. Watson
  • 3,752
  • 4
  • 32
  • 43
2
votes
1 answer

How to get the program name in an escript program?

I have an Erlang program meant to be run using escript: % filename: myscript.erl -export([main/1]). main(Args) -> io:format("Args: ~p~n", [Args]). When I run escript myscript.erl 123 456, this is printed: Args: ["123","456"] This is good, but…
Flux
  • 9,805
  • 5
  • 46
  • 92
2
votes
3 answers

Elixir or Erlang prompt for password with hidden input

I'm writing a CLI in elixir, how can I prompt the user for a password, without displaying the input in the terminal?
Baruch
  • 1,133
  • 10
  • 18
2
votes
3 answers

esrcript cron blues

I have an escript file which runs fine from the command line, i.e.: ./escript_file It is meant to be cron friendly and all paths are explicit but when I run it, it fails to compile saying that there are bad attributes. The bad attributes in…
Gordon Guthrie
  • 6,252
  • 2
  • 27
  • 52
2
votes
1 answer

Running An Erlang Escript File With SSL Distribution

I have a little escript file that connects to a node and does some rpc calls and stuff... It works fine for short or longnames but relies on standard http comms for distributed Erlang. I would like to use it but with https/SSL for distribution. To…
Gordon Guthrie
  • 6,252
  • 2
  • 27
  • 52
2
votes
1 answer

Use Erlang etop to dump information to a file?

What is the command line options to use Erlang etop to dump Erlang program information to a file? If this cannot be done in command line, can it be done in an escript?
1
vote
1 answer

ejabberd extauth using erlang escript

I am using ejabberd in one of my project, which is itself implemented in erlang. I am interested in gaining access to the authentication flow, so that i can integrate my user db without having to register them separately in ejabberd. I have got most…
Abhinav Singh
  • 2,643
  • 1
  • 19
  • 29
1
vote
3 answers

Why does my simple Erlang server not close?

Source file: -module(biu_server). -export([start_server/0]). start_server() -> {ok, Listen} = gen_tcp:listen(1332, [binary, {packet, 4},{reuseaddr, true}, {active, true}]), spawn(fun() -> par_connect(Listen) end). par_connect(Listen)…
Leviathan
  • 335
  • 2
  • 5
  • 10
1
vote
0 answers

Erlang beam_lib chunks is broken?

I've tried to decompile .beam file (compiled from elixir code) I used this escript main([BeamFile]) -> {ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]), io:fwrite("~s~n",…
Krzysztof Wende
  • 3,208
  • 25
  • 38
1
vote
1 answer

Can't send anything to spawned Erlang process

I have the following Erlang code: #!/usr/bin/env escript %%! -pz ../deps/amqp_client ../deps/rabbit_common ../deps/amqp_client/ebin ../deps/rabbit_common/ebin % RMQ module -module(rmq). -export([main/1, send/1, validate/0,…
esio
  • 1,592
  • 3
  • 17
  • 30
1
2