Closed antimatter15 closed 9 years ago
Since this issue may be affected by the final implementation of issue #13 , let's talk about it after.
Just to confirm that I would like to merge this feature (perhaps extended with possibility of calling $$done$$ with a result) but I haven't got around to reviewing the code.
Thanks for the contribution.
Update: Need to decide how to handle exceptions thrown asynchronously (currently the server would silently die).
Hi Kevin!
I've merged your changes and refactored some of the code. I got rid of function done()
by moving its code into function formatResult()
. I also got rid of variable ranOnce
(now global.$$done$$
is deleted to indicate that a result has already been sent). And finally asynchronous exceptions are caught by listening on process.on("uncaughtException").
Again thanks for this feature.
A lot of NodeJS APIs are asynchronous and callback driven, which means a lot of the time the output doesn't get recorded until the next command is run.
This change makes it so that if a command sets the global
$$async$$
variable true, it will hold off on a response until$$done$$
is called.