-
-
Notifications
You must be signed in to change notification settings - Fork 70
feat: implement reading messages sent from child process #167
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
feat: implement reading messages sent from child process #167
Conversation
ae94455 to
331ab85
Compare
async.el
Outdated
| (with-current-buffer (process-buffer proc) | ||
| (when async-callback | ||
| (funcall async-callback msg-decoded))))) | ||
| (error "end of file"))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error in this case is a handler, not a function. Is this meant to raise an error instead? If not, what's the purpose of returning the string "end of file" from this process filter? BTW, there is also a standard end-of-file error symbol, in case that should be caught/raised instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm super sleep deprived, thanks for the review!
Indeed I ment to catch end-of-file, this happens when we read and reach the end of the chunk the process sent at this moment.
I think errors can just "bubble up" as this code runs in the parent Emacs process. Although handling errors from process filters is a bit tricky and meh overall :/
331ab85 to
a982ab7
Compare
|
BTW here's a real-world use-case I solved with this PR: https://twitter.com/Fuco1337/status/1633632468241727488 Code is here https://github.com/emacs-elsa/Elsa/blob/feature/parallel-dependencies/elsa-parallel.el#L134 |
|
Nice feature, looks good to merge for me, if no other comments from @basil-conto or @jwiegley I will merge soon. |
|
Ok merged, thanks all! |
|
Thanks! |
This patch fixes the
async-sendfrom child to parent. I've added a process filter to go through the child output and on getting a base-64 message I try to parse it and then read the (maybe) sexp, and then use the async-callback to dispatch it to the parent.This implements and fixes the test-5 where it first receives message from the client, than waits a bit and then exists.