[erlang-questions] remsh

Jon Watte jwatte@REDACTED
Fri Jul 15 20:55:29 CEST 2011


Why wouldn't an rpc that does an eval() of erlang "shell" code input work?
Seems easier than faking window-system-specific keycodes...

Sincerely,

jw


--
Americans might object: there is no way we would sacrifice our living
standards for the benefit of people in the rest of the world. Nevertheless,
whether we get there willingly or not, we shall soon have lower consumption
rates, because our present rates are unsustainable.



On Fri, Jul 15, 2011 at 11:30 AM, Vincent de Phily <
vincent.dephily@REDACTED> wrote:

> On Wednesday 13 July 2011 18:23:41 Jon Watte wrote:
> > If I understand it correctly, "remsh" specifies to create an interactive
> > shell conneted to the remote node, but a command-line argument is
> evaluated
> > using the local node.
> > Try evaluating it as a rpc:call expression instead? You won't need a
> -remsh
> > at all then, instead passing the node argument to the rpc call.
>
> That's how I understand it too, and it's really annoying that you can only
> use
> remsh interactively.
>
> rpc:call/4 is fine, but it only works one call at a time, needs to send all
> the results over the wire, and becomes useless as soon as you use terms
> that
> are tied to the VM.
>
> I've tried all maners of techniques to send input to a remsh: -eval,
> -noshell,
> -oldshell, -noinput, using a pipe, echoing in /proc/$PID/fd/0... The only
> thing that works is a hack with X that simulates keyboard input.
>
> Another thing that works is
> erl -noinput -name foobar@REDACTED \
>    -eval "try {ok,S,_} = erl_scan:string(\"$YOURCODEHERE\"),
>               {ok,P} = erl_parse:parse_exprs(S),
>               {value,V,_} = rpc:call('$NODE', erl_eval, exprs, [P,[]]),
>               io:format(\"\\e[32mok\\e[m\n~p\n\", [V])
>           catch
>               _:Err -> io:format(\"\\e[31merror\\e[m\n~p\n\", [Err])
>           end." \
>    -s erlang halt
> but it isn't much more elegant.
>
>
> So I've got some nontrivial code to run remotely and automatically, but for
> various reasons I do not want to have a module loaded on the remote node
> that
> does the work. Most languages with an interactive shell will happily read
> from
> standard input instead of from the tty, but /usr/bin/erl doesn't. It has
> -eval
> which is great, except that it doesn't work with a remote shell. Any idea ?
> --
> Vincent de Phily
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110715/dad0c4fa/attachment.htm>


More information about the erlang-questions mailing list