Re: erl_call -q

Bogdan Andu <[email protected]> Wed, 30 Mar 2022 13:40:11 +0300
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAP7yTnziNwwQ+bp1GStLr=Uo26Ni5YjMLmcmzYUPok82pJHbeg@mail.gmail.com>
--0000000000002da0f805db6d2c15
Content-Type: text/plain; charset="UTF-8"

@Leo Liu

> erl -name t@REDACTED <http://erlang.org/mailman/listinfo/erlang-questions>
-noinput -eval "io:format(\"~p~n\", [rpc:call('somenode@REDACTED
<http://erlang.org/mailman/listinfo/erlang-questions>', math, sin, [1])]),
init:stop()"

Nice hack!

But weird behaviour of -eval. It seems to work only with io:format.
And what is this, undocumented, intimacy between -eval and io:format ?

Isn't suppose -eval to spit out the result of the evaluated block?

Why it needs io:format to do that?

-eval seems to spit out everything io:format throws at it.

io_lib:format/2 is totally ignored, for example.

Rhetorical questions anyway, here. I know -eval will not receive proper
love.

Anyway, it helps in my setup.

Thank you!
Bogdan

@erlang-questions mail list:
I didn't receive the mail from Leo Liu in my personal inbox to make a
proper reply!
Why is that happening?!?


On Tue, Mar 29, 2022 at 4:37 PM Bogdan Andu <[email protected]> wrote:

> But this defeats the purpose of NOT having a dedicated node to run a
> dedicated module
> to just stop nodes. Really? I was expecting this 'solution'.
> C'mon man, this is erlang we are talking about!
>
> It could do better than this!
>
>
>
>
> On Tue, Mar 29, 2022 at 4:27 PM Luke Bakken <[email protected]> wrote:
>
>> At this point I would put together a small module, and use -s or -eval
>> to run the code. erlc is right there!
>>
>> On Tue, Mar 29, 2022 at 6:26 AM Bogdan Andu <[email protected]> wrote:
>> >
>> > I know erl -eval, but elixir --rpc-eval gives the error also, like this:
>> > --rpc-eval : RPC failed with reason :nodedown
>> > while erl -eval is silent about errors like node down which is very
>> important.
>> >
>> > May be a try catch would do the trick but already is too much to pass
>> to eval.
>> >
>> > On Tue, Mar 29, 2022 at 3:57 PM Luke Bakken <[email protected]> wrote:
>> >>
>> >> Give "-eval" a try instead.
>> >>
>> >> On Tue, Mar 29, 2022 at 5:40 AM Bogdan Andu <[email protected]> wrote:
>> >> >
>> >> > Hi,
>> >> >
>> >> > I tried that before like this:
>> >> > $ erl -setcookie proxy -proto_dist inet_tls -ssl_dist_optfile
>> file_with_pem -name 'stop-node@host' -s rpc call target-node@host init
>> stop []
>> >> > Erlang/OTP 24 [erts-12.3] [source] [64-bit] [smp:4:4] [ds:4:4:10]
>> [async-threads:1]
>>
>

--0000000000002da0f805db6d2c15
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>@Leo Liu</div><div><br></div><div>&gt; erl -name <a h=
ref=3D"http://erlang.org/mailman/listinfo/erlang-questions">t@REDACTED</a> =
-noinput -eval &quot;io:format(\&quot;~p~n\&quot;, [rpc:call(&#39;<a href=
=3D"http://erlang.org/mailman/listinfo/erlang-questions">somenode@REDACTED<=
/a>&#39;, math, sin, [1])]), init:stop()&quot;</div><div><br></div><div>Nic=
e hack! <br></div><div><br></div><div>But weird behaviour of -eval. It seem=
s to work only with io:format.</div><div>And what is this, undocumented, in=
timacy between -eval and io:format ?</div><div><br></div><div>Isn&#39;t sup=
pose -eval to spit out the result of the evaluated block?</div><div><br></d=
iv><div>Why it needs io:format to do that?<br></div><div><br></div><div>-ev=
al seems to spit out everything io:format throws at it.</div><div><br></div=
><div>io_lib:format/2 is totally ignored, for example.<br></div><div><br></=
div><div>Rhetorical questions anyway, here. I know -eval will not receive p=
roper love.<br></div><div><br></div><div>Anyway, it helps in my setup.</div=
><div><br></div><div>Thank you!</div><div>Bogdan</div><div><br></div><div>@=
erlang-questions mail list:
</div><div>I didn&#39;t receive the mail from Leo Liu in my personal inbox =
to make a proper reply!</div><div>Why is that happening?!?</div><div><br></=
div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_at=
tr">On Tue, Mar 29, 2022 at 4:37 PM Bogdan Andu &lt;<a href=3D"mailto:bog49=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><div dir=3D"ltr"><div>But this <span><span><sp=
an><span>defeats the purpose</span><em> </em><span>of</span> NOT having a d=
edicated node to run a dedicated module</span></span></span></div><div><spa=
n><span><span>to just stop nodes. Really? I was expecting this &#39;solutio=
n&#39;.<br></span></span></span></div><div><span><span><span>C&#39;mon man,=
 this is erlang we are talking about!<br></span></span></span></div><div><s=
pan><span><span><br></span></span></span></div><div><span><span><span>It co=
uld do better than this!<br></span></span></span></div><div><span><span><sp=
an><br></span></span></span></div><div><span><span><span><br></span></span>=
</span></div><div><span><span><span><br> </span></span></span></div></div><=
br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue,=
 Mar 29, 2022 at 4:27 PM Luke Bakken &lt;<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">At this point I would put together a small=
 module, and use -s or -eval<br>
to run the code. erlc is right there!<br>
<br>
On Tue, Mar 29, 2022 at 6:26 AM Bogdan Andu &lt;<a href=3D"mailto:bog495@gm=
ail.com" target=3D"_blank">[email protected]</a>&gt; wrote:<br>
&gt;<br>
&gt; I know erl -eval, but elixir --rpc-eval gives the error also, like thi=
s:<br>
&gt; --rpc-eval : RPC failed with reason :nodedown<br>
&gt; while erl -eval is silent about errors like node down which is very im=
portant.<br>
&gt;<br>
&gt; May be a try catch would do the trick but already is too much to pass =
to eval.<br>
&gt;<br>
&gt; On Tue, Mar 29, 2022 at 3:57 PM Luke Bakken &lt;<a href=3D"mailto:luke=
@bakken.io" target=3D"_blank">[email protected]</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Give &quot;-eval&quot; a try instead.<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Mar 29, 2022 at 5:40 AM Bogdan Andu &lt;<a href=3D"mailto:=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I tried that before like this:<br>
&gt;&gt; &gt; $ erl -setcookie proxy -proto_dist inet_tls -ssl_dist_optfile=
 file_with_pem -name &#39;stop-node@host&#39; -s rpc call target-node@host =
init stop []<br>
&gt;&gt; &gt; Erlang/OTP 24 [erts-12.3] [source] [64-bit] [smp:4:4] [ds:4:4=
:10] [async-threads:1]<br>
</blockquote></div>
</blockquote></div>

--0000000000002da0f805db6d2c15--