Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdio repl handling of both stderr and stdout for a form can be a problem sometimes #546

Open
sogaiu opened this issue Dec 17, 2023 · 1 comment

Comments

@sogaiu
Copy link

sogaiu commented Dec 17, 2023

If using Janet's stdio repl [1], evaluating the following form leads to on-stray-output being called sometimes:

(do                                                     
  (print "out")
  (error "err"))

IIUC, this occurs because a callback (cb) gets cleared here as a result of on-stdout triggering before on-stderr (and they both call on-message).

By the time on-stderr gets called, cb ends up being bound to on-stray-output because of this.

In my limited testing at the command line (evaluating the same form), stdout output appears to complete after stderr output which is the reverse order of the callbacks being called. I suppose it's possible that that's just the way it could end up being when using event-based things like libuv?


[1] Possibly this may be an issue for other languages too as relevant code lives in fnl/conjure/remote/stdio.fnl.

@russtoku
Copy link
Contributor

russtoku commented Apr 1, 2024

If you're up to modifying the Janet client code, you could try replacing:

stdio conjure.remote.stdio

with:

stdio conjure.remote.stdio-rt

Please see:

(eval-str (a.assoc opts :code (a.slurp opts.file-path))))

for how things are handled in the SQL client. This might work with a Janet REPL.

This is suggested as a simple work-around for handling other stdio clients. When @Olical completes his modularisation work (#500), hopefully, we can improve how the various REPLs work with Conjure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants