I have a simple pipeline:
node foo.js | node bar.js
bar.js
will read from stdin to get data from foo.js
.
But what I want to do is ensure that bar.js
gets one of the last messages from foo.js
before foo.js decides it's OK to exit. Essentially I want to create a simple request/response pattern.
foo writes to stdout --> bar reads from stdin --> how can bar send a message back to foo?
Is there a way to communicate backwards in a pipeline or should there never be a need to do that?
node bar.js
won't exit until all data has been read from stdin, but the question still stands anyway, just for the heck of it.