lfeutre/port-examples

Processing of messages in language server isn't quite right

oubiwann opened this issue · 1 comments

This project is a fork of the Erlang project of the same name, ported to LFE; that, in turn, was a sanitized version of a private repo I created as a going-away gift for a dear friend and CTO of the company where I work (we'd always planned to do some Erlang R&D together, but never got around to it). I continued to make improvements on that going-away code-card for the CTO, even after I created the public versions of the Go and Common Lisp servers.

As such, I need to comb through those changes and bring them over, as the private version is working flawlessly with output such as the following:

(goodbyewil@spacemac)1> go_server:send({command, gen_commit_msg}).
{result,"lol"}
(goodbyewil@spacemac)2> lisp_server:send({command, gen_commit_msg}).
{result,"Okay, so here's the entire history of the project: 1) ..."}
(goodbyewil@spacemac)3> go_server:send({command, get_quote}).
{result,"I appreciate you guys!"}
(goodbyewil@spacemac)4> lisp_server:send({command, get_quote}).
{result,"I love me some Jupyter Notebooks ..."}

while the LFE-managed echo servers are cranking out stuff like this:

(ports@spacemac)lfe> (go-echo-server:send #(command echo))
'nodata            
(ports@spacemac)2> =ERROR REPORT==== 21-Aug-2020::10:25:12.865928 ===
Got empty data from {<0.377.0>,#Ref<0.426298652.499384326.174945>}; continuing ...
(ports@spacemac)lfe> =ERROR REPORT==== 21-Aug-2020::10:25:12.866239 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<131>>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866324 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"h">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866371 ===
The Go echo server is handling info of type: {#Port<0.7>,{data,{noeol,<<2>>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866430 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"s">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866510 ===
The Go echo server is handling info of type: {#Port<0.7>,{data,{noeol,<<6>>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866562 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"r">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866607 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"e">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866655 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"s">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866691 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"u">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866725 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"l">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866774 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"t">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866809 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"k">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866859 ===
The Go echo server is handling info of type: {#Port<0.7>,{data,{noeol,<<0>>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866891 ===
The Go echo server is handling info of type: {#Port<0.7>,{data,{noeol,<<4>>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866934 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"e">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.866976 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"c">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.867027 ===
The Go echo server is handling info of type: {#Port<0.7>,
                                              {data,{noeol,<<"h">>}}}.
=ERROR REPORT==== 21-Aug-2020::10:25:12.867065 ===
The Go echo server is handling info of type: {#Port<0.7>,{data,{eol,<<"o">>}}}.

which is debugging output from an earlier stage of development.

Ah, found the issue. A let block doing a receive got moved to before the send.