[erlang-questions] remsh
vincent dephily
vincent.dephily@REDACTED
Sat Jul 16 14:21:59 CEST 2011
2011/7/15, Jon Watte <jwatte@REDACTED>:
> Why wouldn't an rpc that does an eval() of erlang "shell" code input work?
> Seems easier than faking window-system-specific keycodes...
I believe the code from my previous mail (requoted below) is as close
as it gets to what you suggest. Unless I've missed a public API that
is simpler than the scan/parse/eval dance I've used here, in which
case I'd love some pointers.
But I think that kind of solution is a missed opportunity for
/usr/bin/erl anyway : we've got an amazing "-remsh" feature (which, if
I understand correctly, is implemented partially at the VM level ?),
but it is hampered by the impossibility of feeding code into it. I
*can* get things done with rpc (plus eval if necessary), but that's
much more complicated than it should be.
>> 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.
--
Vincent de Phily
More information about the erlang-questions
mailing list