[erlang-questions] Programmatically starting a remote shell

Per Melin per.melin@REDACTED
Tue Feb 23 21:44:35 CET 2010


On Tue, Feb 23, 2010 at 6:18 PM, Andrew Thompson <andrew@REDACTED> wrote:
> I couldn't even get a fully working local shell out of an escript (I got
> close but there were still some screwy issues). It'd be nice to either
> be able to *fully* promote an escript to a shell or to have exec(3)
> support in escripts so you could launch erl with the options you
> determine you need.

Not perfect, but I get something (at first glance) usable with:
main(_) -> shell:server(false, false).

Haven't tested it for more than ten seconds, but that can turn into a
remote shell:
main(_) ->
    net_kernel:start([foo@REDACTED, longnames]),
    rpc:call(bar@REDACTED, shell, server, [false, false]).

I'm not absolutely sure, but I think that when you run this:
$ escript ./foo arg1 arg2

…what essentially gets executed is this:
$ erl +B -noshell -s escript -- ./foo arg1 arg2

And I wonder if the -noshell switch does something other than just not
starting a shell? Something that will make it impossible to get a 100%
functioning shell?


More information about the erlang-questions mailing list