erlaunch - efficiently execute selected Erlang functions from command line
erlaunch [-p port] [-s shell] [-f] [-c cookie] start
erlaunch [-h host] [-p port] [-s shell] [-f] -c cookie connect
erlaunch status
erlaunch command {argument}
erlaunch start
spawns a detached Erlang/OTP BEAM emulator,
sets the environment variables ERLAUNCH_HOST
, ERLAUNCH_PORT
,
and ERLAUNCH_COOKIE
to refer to that emulator, and starts
a subshell. When the subshell is exited, the emulator exits as well.
erlaunch connect
connects to an existing emulator, setting
the environment variables as erlaunch start
.
erlaunch status
reports whether a detached emulator is
running based on the current settings of environment variables.
erlaunch command arg1 arg2 ... argN
looks up the environment variables set by a previous
erlaunch start
or erlaunch connect
, uses them
to establish a TCP/IP dialogue with the emulator, and asks the emulator
to execute the given command with the given arguments.
-h host
Specify the host on which the server resides.
If not given, defaults to 127.0.0.1
(the loopback address.)
Only sensible in combination with connect
.
-p port
Specify the port on which the server is listening, or should be
listening.
If not given, defaults to 17779.
Only sensible in combination with start
and connect
.
-s shell
Specify the shell which should be run once the emulator has launched.
If not given, defaults to the value of the SHELL
environment variable.
Only sensible in combination with start
and
connect
.
-c cookie
Specify the cookie which the server is using to authenticate, or
should use to authenticate.
If not given, a random cookie is generated internally.
Only sensible in combination with start
and
connect
; essentially mandatory in combination with
connect
.
-f
Force a new shell to be invoked (with start
and connect
)
and a new emulator to be launched (with start
) even if environment
variables are set indicating that an emulator has already been launched.
See the example priv/erlaunch.cmds
file.
erl_call(1)
, escript(1)
Assuredly many.
Ideally, the erlaunch
client should contain a break handler
that sends an end-of-file condition to the server when interrupted.
It would be very nice to be able to determine whether the server was launched sucessfully before starting the subshell.
erlaunch
should be able to determine command
from argv[0]
, so that different symbolic links pointing to the
erlaunch
executable can invoke different commands.
-h
, -p
, and -c
options are
probably sensible in combination with
erlaunch command {argument}
, but they do not
currently have any effect.
send_array
is particularly inefficient on both ends.
A future version might coalesce the entire array into a single packet.
The protocol could be optimized by having each command say whether it needs arguments, the current working directory, or the environment, and only transferring over the TCP/IP connection, those which are actually needed by the command.